import numpy as np

N = int(eval(input()))

A = np.array(input().split(), dtype = np.int32)



counter = np.bincount(A)

B = counter.copy()

B[1:] += counter[:-1]

B[:-1] += counter[1:]



ans = B.max()

print(ans)
from collections import Counter

n = int(eval(input()))

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



ans = 0

p = 0

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

    p = y

    if x-1 in a: p += a[x-1]

    if x+1 in a: p += a[x+1]

    if p > ans: ans = p

print(ans)
import numpy as np

N = int(eval(input()))
A = np.array(input().split(), dtype=np.int32)
counter = np.bincount(A)
B = counter.copy()
B[1:] += counter[:-1]
B[:-1] += counter[1:]
ans = B.max()
print(ans)

from collections import Counter

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

-import numpy as np +from collections import Counter -N = int(eval(input())) -A = np.array(input().split(), dtype=np.int32) -counter = np.bincount(A) -B = counter.copy() -B[1:] += counter[:-1] -B[:-1] += counter[1:] -ans = B.max() +n = int(eval(input())) +a = Counter(sorted(list(map(int, input().split())))) +ans = 0 +p = 0 +for x, y in list(a.items()): +    p = y +    if x - 1 in a: +        p += a[x - 1] +    if x + 1 in a: +        p += a[x + 1] +    if p > ans: +        ans = p