import bisect

n=int(eval(input()))

a=sorted([int(i) for i in input().split()])



ma=0

for i in range(10**5):

    ma=max(bisect.bisect_right(a,i+1)-bisect.bisect_left(a,i-1),ma)

print(ma)

import bisect

n=int(eval(input()))

a=[int(i) for i in input().split()]

b=[0]*(10**5)

for i in range(n):

    b[a[i]]+=1

ma=0

for i in range(1,10**5-1):

    ma=max(b[i-1]+b[i]+b[i+1],ma)

print(ma)

#累積和でやると早い

import bisect

n = int(eval(input()))
a = sorted([int(i) for i in input().split()])
ma = 0
for i in range(10**5):
    ma = max(bisect.bisect_right(a, i + 1) - bisect.bisect_left(a, i - 1), ma)
print(ma)

import bisect

n = int(eval(input()))
a = [int(i) for i in input().split()]
b = [0] * (10**5)
for i in range(n):
    b[a[i]] += 1
ma = 0
for i in range(1, 10**5 - 1):
    ma = max(b[i - 1] + b[i] + b[i + 1], ma)
print(ma)
# 累積和でやると早い

-a = sorted([int(i) for i in input().split()]) +a = [int(i) for i in input().split()] +b = [0] * (10**5) +for i in range(n): +    b[a[i]] += 1 -for i in range(10**5): -    ma = max(bisect.bisect_right(a, i + 1) - bisect.bisect_left(a, i - 1), ma) +for i in range(1, 10**5 - 1): +    ma = max(b[i - 1] + b[i] + b[i + 1], ma) +# 累積和でやると早い