import numpy as np;c=[0]*10**5;eval(input())

for i in map(int,input().split()):

    c[i]+=1

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

for i in map(int,input().split()):

    c[i]+=1

print((max([sum(c[i:i+3]) for i in range(10**5)])))
import numpy as np

c = [0] * 10**5
eval(input())
for i in map(int, input().split()):
    c[i] += 1
print((max([sum(c[i : i + 3]) for i in range(10**5)])))

c = [0] * 10**5
eval(input())
for i in map(int, input().split()):
    c[i] += 1
print((max([sum(c[i : i + 3]) for i in range(10**5)])))

-import numpy as np -