N = int(eval(input()))

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

L = [0] * 10 ** 5

for i in range(N):

    L[a[i]] += 1

s = L[0] + L[1] + L[2]

A = s

for i in range(10 ** 5-3):

    s += L[i+3] - L[i]

    A = max(A,s)

print(A)

N = int(eval(input()))

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



num_list = [0 for _ in range(10 ** 5)]

for i in a:

    if i > 0:

        num_list[i - 1] += 1

    num_list[i] += 1

    if i < 10 ** 5 - 1:

        num_list[i + 1] += 1

print((max(num_list)))

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

N = int(eval(input()))
a = list(map(int, input().split()))
num_list = [0 for _ in range(10**5)]
for i in a:
    if i > 0:
        num_list[i - 1] += 1
    num_list[i] += 1
    if i < 10**5 - 1:
        num_list[i + 1] += 1
print((max(num_list)))

-L = [0] * 10**5 -for i in range(N): -    L[a[i]] += 1 -s = L[0] + L[1] + L[2] -A = s -for i in range(10**5 - 3): -    s += L[i + 3] - L[i] -    A = max(A, s) -print(A) +num_list = [0 for _ in range(10**5)] +for i in a: +    if i > 0: +        num_list[i - 1] += 1 +    num_list[i] += 1 +    if i < 10**5 - 1: +        num_list[i + 1] += 1 +print((max(num_list)))