from collections import Counter

n = int(eval(input()))

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

count_a = Counter(a)



result = []

for i in range(min(a),max(a)+1):

    result.append(count_a[i]+count_a[i-1]+count_a[i+1])

print((max(result)))
from collections import Counter

n = int(eval(input()))

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

set_a = list(set(a))

#set_a = sorted(set_a)

count_a = Counter(a)



result = []

for i in set_a:

    result.append(count_a[i]+count_a[i-1]+count_a[i+1])

print((max(result)))
from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
count_a = Counter(a)
result = []
for i in range(min(a), max(a) + 1):
    result.append(count_a[i] + count_a[i - 1] + count_a[i + 1])
print((max(result)))

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
set_a = list(set(a))
# set_a = sorted(set_a)
count_a = Counter(a)
result = []
for i in set_a:
    result.append(count_a[i] + count_a[i - 1] + count_a[i + 1])
print((max(result)))

+set_a = list(set(a)) +# set_a = sorted(set_a) -for i in range(min(a), max(a) + 1): +for i in set_a: