from collections import Counter





N = int(eval(input()))

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

# set_A = set(lst_A)

cnt_A = Counter(lst_A)

ans = 0





# for key in set_A:

for key in lst_A:

    cnt_X = cnt_A[key - 1] + cnt_A[key] + cnt_A[key + 1]

    ans = max(ans, cnt_X)





print(ans)
N = int(eval(input()))

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

lst_cnt = [0] * (10**6)

ans = 0





for a in lst_A:

    lst_cnt[a - 1] += 1

    lst_cnt[a] += 1

    lst_cnt[a + 1] += 1

ans = max(lst_cnt)





print(ans)
from collections import Counter

N = int(eval(input()))
lst_A = list(map(int, input().split()))
# set_A = set(lst_A)
cnt_A = Counter(lst_A)
ans = 0
# for key in set_A:
for key in lst_A:
    cnt_X = cnt_A[key - 1] + cnt_A[key] + cnt_A[key + 1]
    ans = max(ans, cnt_X)
print(ans)

N = int(eval(input()))
lst_A = list(map(int, input().split()))
lst_cnt = [0] * (10**6)
ans = 0
for a in lst_A:
    lst_cnt[a - 1] += 1
    lst_cnt[a] += 1
    lst_cnt[a + 1] += 1
ans = max(lst_cnt)
print(ans)

-from collections import Counter - -# set_A = set(lst_A) -cnt_A = Counter(lst_A) +lst_cnt = [0] * (10**6) -# for key in set_A: -for key in lst_A: -    cnt_X = cnt_A[key - 1] + cnt_A[key] + cnt_A[key + 1] -    ans = max(ans, cnt_X) +for a in lst_A: +    lst_cnt[a - 1] += 1 +    lst_cnt[a] += 1 +    lst_cnt[a + 1] += 1 +ans = max(lst_cnt)