from collections import defaultdict



n = int(eval(input()))



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

A_dict = defaultdict(int)



for i in a_lis:

  A_dict[i] += 1

  

max_cnt = 0



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

  tmp = A_dict[j-1]+A_dict[j]+A_dict[j+1]

  max_cnt = max(max_cnt, tmp)

print(max_cnt)
from collections import defaultdict



n = int(eval(input()))

ans = 0



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

A_dict = [0]*(10**5+1)



for i in a_lis:

  A_dict[i] += 1



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

  tmp = A_dict[j-1]+A_dict[j]+A_dict[j+1]

  if tmp > ans:

    ans = tmp

print(ans)
from collections import defaultdict

n = int(eval(input()))
a_lis = list(map(int, input().split()))
A_dict = defaultdict(int)
for i in a_lis:
    A_dict[i] += 1
max_cnt = 0
for j in range(1, 10**5):
    tmp = A_dict[j - 1] + A_dict[j] + A_dict[j + 1]
    max_cnt = max(max_cnt, tmp)
print(max_cnt)

from collections import defaultdict

n = int(eval(input()))
ans = 0
a_lis = list(map(int, input().split()))
A_dict = [0] * (10**5 + 1)
for i in a_lis:
    A_dict[i] += 1
for j in range(1, 10**5):
    tmp = A_dict[j - 1] + A_dict[j] + A_dict[j + 1]
    if tmp > ans:
        ans = tmp
print(ans)

+ans = 0 -A_dict = defaultdict(int) +A_dict = [0] * (10**5 + 1) -max_cnt = 0 -    max_cnt = max(max_cnt, tmp) -print(max_cnt) +    if tmp > ans: +        ans = tmp +print(ans)