N = int(eval(input()))

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



ans = 0

numcnt = {i:0 for i in range(100001)}



for i in a:

    numcnt[i]+=1

    

for x in range(1,100000):

    subans = numcnt[x-1]+numcnt[x]+numcnt[x+1]

        

    ans = max(ans,subans)

    

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

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



ans = 0

numcnt = [0]*100001



for i in a:

    numcnt[i]+=1

    

for x in range(1,100000):

    subans = numcnt[x-1]+numcnt[x]+numcnt[x+1]

        

    ans = max(ans,subans)

    

print(ans)
N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
numcnt = {i: 0 for i in range(100001)}
for i in a:
    numcnt[i] += 1
for x in range(1, 100000):
    subans = numcnt[x - 1] + numcnt[x] + numcnt[x + 1]
    ans = max(ans, subans)
print(ans)

N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
numcnt = [0] * 100001
for i in a:
    numcnt[i] += 1
for x in range(1, 100000):
    subans = numcnt[x - 1] + numcnt[x] + numcnt[x + 1]
    ans = max(ans, subans)
print(ans)

-numcnt = {i: 0 for i in range(100001)} +numcnt = [0] * 100001