import collections

N=int(eval(input()))

li=list(map(int,input().split()))



for n in range(N):

  plus=li[n]+1

  minus=li[n]-1

  li.append(plus)

  li.append(minus)



ans=collections.Counter(li)

print((ans.most_common()[0][1]))

from collections import Counter



n = int(eval(input()))

a = list(map(int,input().split()))



ac = Counter(a)



ans = 0

for i in range(1,10**5):

    ans = max(ans, ac[i-1]+ac[i]+ac[i+1])

print(ans)
import collections

N = int(eval(input()))
li = list(map(int, input().split()))
for n in range(N):
    plus = li[n] + 1
    minus = li[n] - 1
    li.append(plus)
    li.append(minus)
ans = collections.Counter(li)
print((ans.most_common()[0][1]))

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
ac = Counter(a)
ans = 0
for i in range(1, 10**5):
    ans = max(ans, ac[i - 1] + ac[i] + ac[i + 1])
print(ans)

-import collections +from collections import Counter -N = int(eval(input())) -li = list(map(int, input().split())) -for n in range(N): -    plus = li[n] + 1 -    minus = li[n] - 1 -    li.append(plus) -    li.append(minus) -ans = collections.Counter(li) -print((ans.most_common()[0][1])) +n = int(eval(input())) +a = list(map(int, input().split())) +ac = Counter(a) +ans = 0 +for i in range(1, 10**5): +    ans = max(ans, ac[i - 1] + ac[i] + ac[i + 1]) +print(ans)