from bisect import bisect_right

N = int(eval(input()))

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

cmax = 0

for i in range(N):

    a = A[i]

    ind = bisect_right(A,a+2)

    cmax = max(cmax,ind-i)

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

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

C = {}

for i in range(N):

    if A[i] not in C:

        C[A[i]] = 0

    C[A[i]] += 1

cmax = 0

for a in A:

    cnt = C[a]

    if a-1 in C:

        cnt += C[a-1]

    if a+1 in C:

        cnt += C[a+1]

    cmax = max(cmax,cnt)

print(cmax)
from bisect import bisect_right

N = int(eval(input()))
A = sorted(list(map(int, input().split())))
cmax = 0
for i in range(N):
    a = A[i]
    ind = bisect_right(A, a + 2)
    cmax = max(cmax, ind - i)
print(cmax)

N = int(eval(input()))
A = list(map(int, input().split()))
C = {}
for i in range(N):
    if A[i] not in C:
        C[A[i]] = 0
    C[A[i]] += 1
cmax = 0
for a in A:
    cnt = C[a]
    if a - 1 in C:
        cnt += C[a - 1]
    if a + 1 in C:
        cnt += C[a + 1]
    cmax = max(cmax, cnt)
print(cmax)

-from bisect import bisect_right - -A = sorted(list(map(int, input().split()))) +A = list(map(int, input().split())) +C = {} +for i in range(N): +    if A[i] not in C: +        C[A[i]] = 0 +    C[A[i]] += 1 -for i in range(N): -    a = A[i] -    ind = bisect_right(A, a + 2) -    cmax = max(cmax, ind - i) +for a in A: +    cnt = C[a] +    if a - 1 in C: +        cnt += C[a - 1] +    if a + 1 in C: +        cnt += C[a + 1] +    cmax = max(cmax, cnt)