from collections import Counter

N = int(eval(input()))

A = Counter(list(map(int,input().split())))

Ans = 0

for n,c in A.most_common():

    Ans = max(Ans,A[n]+A[n-1]+A[n+1])

print(Ans)
from collections import Counter

N = int(eval(input()))

A = Counter(list(map(int,input().split())))

Ans = 0

B = A.most_common()

for n,c in B:

    Ans = max(Ans,A[n]+A[n-1]+A[n+1])

print(Ans)
from collections import Counter

N = int(eval(input()))
A = Counter(list(map(int, input().split())))
Ans = 0
for n, c in A.most_common():
    Ans = max(Ans, A[n] + A[n - 1] + A[n + 1])
print(Ans)

from collections import Counter

N = int(eval(input()))
A = Counter(list(map(int, input().split())))
Ans = 0
B = A.most_common()
for n, c in B:
    Ans = max(Ans, A[n] + A[n - 1] + A[n + 1])
print(Ans)

-for n, c in A.most_common(): +B = A.most_common() +for n, c in B: