integer N,ans(-1:10**5+1)
integer,allocatable,dimension(:)::A
read*,N
allocate(A(N))
read*,A
ans=0
do i=1,N
  ans(A(i)-1)=ans(A(i)-1)+1
  ans(A(i)  )=ans(A(i)  )+1
  ans(A(i)+1)=ans(A(i)+1)+1
end do
print"(i0)",maxval(ans)
end