from collections import Counter 

N = int(eval(input()))

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

cnt = 0

for i in A:

    sums = A[i] + A[i+1] + A[i+2]

    if sums > cnt:

        cnt = sums

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

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

x = [0]*((10**5) + 2)

for i in a:

    x[i+1] += 1

    x[i] += 1

    x[i+2] += 1

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

N = int(eval(input()))
A = Counter(list(map(int, input().split())))
cnt = 0
for i in A:
    sums = A[i] + A[i + 1] + A[i + 2]
    if sums > cnt:
        cnt = sums
print(cnt)

N = int(eval(input()))
a = list(map(int, input().split()))
x = [0] * ((10**5) + 2)
for i in a:
    x[i + 1] += 1
    x[i] += 1
    x[i + 2] += 1
print((max(x)))

-from collections import Counter - -A = Counter(list(map(int, input().split()))) -cnt = 0 -for i in A: -    sums = A[i] + A[i + 1] + A[i + 2] -    if sums > cnt: -        cnt = sums -print(cnt) +a = list(map(int, input().split())) +x = [0] * ((10**5) + 2) +for i in a: +    x[i + 1] += 1 +    x[i] += 1 +    x[i + 2] += 1 +print((max(x)))