cnt = [0]*10**5; eval(input())

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

for x in a:cnt[x]+=1

print((max(sum(cnt[i:i+3])for i in range(10**5))))
cnt = [0]*10**5; eval(input())

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

for x in a:cnt[x]+=1

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

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

-print((max(sum(cnt[i : i + 3]) for i in range(10**5)))) +print((max(list(map(sum, list(zip(cnt, cnt[1:], cnt[2:])))))))