program main
	implicit none
	integer:: champ=0,n,a(100000),i,maxa,j,x
	read(*,*)n
	read(*,*)a(1:n)
	maxa=maxval(a(1:n))
	do i=2,maxa-1
		x=0
		do j=1,n
			if(abs(i-a(j))<=1)x=x+1
		enddo
		if(champ<x)champ=x
	enddo
	write(*,*)champ
end program main
