n = int(eval(input()))

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

cnt = {}

for a in A:

    if a-1 not in cnt: cnt[a-1] = 1

    else: cnt[a-1] += 1

    if a not in cnt: cnt[a] = 1

    else: cnt[a] += 1

    if a+1 not in cnt: cnt[a+1] = 1

    else: cnt[a+1] += 1

print((max(cnt.values())))
from collections import Counter

n = int(eval(input()))

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

A = Counter(a)

ans = 0

for x,y in list(A.items()):

    z = y + A[x-1] + A[x+1]

    ans = max(z, ans)

print(ans)
n = int(eval(input()))
A = list(map(int, input().split()))
cnt = {}
for a in A:
    if a - 1 not in cnt:
        cnt[a - 1] = 1
    else:
        cnt[a - 1] += 1
    if a not in cnt:
        cnt[a] = 1
    else:
        cnt[a] += 1
    if a + 1 not in cnt:
        cnt[a + 1] = 1
    else:
        cnt[a + 1] += 1
print((max(cnt.values())))

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
A = Counter(a)
ans = 0
for x, y in list(A.items()):
    z = y + A[x - 1] + A[x + 1]
    ans = max(z, ans)
print(ans)

+from collections import Counter + -A = list(map(int, input().split())) -cnt = {} -for a in A: -    if a - 1 not in cnt: -        cnt[a - 1] = 1 -    else: -        cnt[a - 1] += 1 -    if a not in cnt: -        cnt[a] = 1 -    else: -        cnt[a] += 1 -    if a + 1 not in cnt: -        cnt[a + 1] = 1 -    else: -        cnt[a + 1] += 1 -print((max(cnt.values()))) +a = list(map(int, input().split())) +A = Counter(a) +ans = 0 +for x, y in list(A.items()): +    z = y + A[x - 1] + A[x + 1] +    ans = max(z, ans) +print(ans)