# -*- coding: utf-8 -*-

from collections import Counter

N = int(eval(input()))

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



c0 = Counter()

c1 = Counter()

c2 = Counter()

for a in A:

    c0[(a+0)//3] += 1

    c1[(a+1)//3] += 1

    c2[(a+2)//3] += 1

    

print((max(sorted(list(c0.values()), reverse = True)[0],

          sorted(list(c1.values()), reverse = True)[0],

          sorted(list(c2.values()), reverse = True)[0])))  

# -*- coding: utf-8 -*-

from collections import Counter

N = int(eval(input()))

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



c0 = Counter()

c1 = Counter()

c2 = Counter()

for a in A:

    c0[(a+0)//3] += 1

    c1[(a+1)//3] += 1

    c2[(a+2)//3] += 1

    

print((max(max(c0.values()),

          max(c1.values()),

          max(c2.values())))) 
# -*- coding: utf-8 -*-
from collections import Counter

N = int(eval(input()))
A = tuple(map(int, input().split()))
c0 = Counter()
c1 = Counter()
c2 = Counter()
for a in A:
    c0[(a + 0) // 3] += 1
    c1[(a + 1) // 3] += 1
    c2[(a + 2) // 3] += 1
print(
    (
        max(
            sorted(list(c0.values()), reverse=True)[0],
            sorted(list(c1.values()), reverse=True)[0],
            sorted(list(c2.values()), reverse=True)[0],
        )
    )
)

# -*- coding: utf-8 -*-
from collections import Counter

N = int(eval(input()))
A = tuple(map(int, input().split()))
c0 = Counter()
c1 = Counter()
c2 = Counter()
for a in A:
    c0[(a + 0) // 3] += 1
    c1[(a + 1) // 3] += 1
    c2[(a + 2) // 3] += 1
print((max(max(c0.values()), max(c1.values()), max(c2.values()))))

-print( -    ( -        max( -            sorted(list(c0.values()), reverse=True)[0], -            sorted(list(c1.values()), reverse=True)[0], -            sorted(list(c2.values()), reverse=True)[0], -        ) -    ) -) +print((max(max(c0.values()), max(c1.values()), max(c2.values()))))