from collections import Counter

n=int(eval(input()))

l=[]

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

for i in range(n):

  l.append(a[i]-1)

  l.append(a[i])

  l.append(a[i]+1)

ans=Counter(l)

print((ans.most_common()[0][1]))
import sys

from collections import Counter

from collections import deque

def input(): return sys.stdin.readline().strip()

def mp(): return list(map(int,input().split()))

def lmp(): return list(map(int,input().split()))

n=int(eval(input()))

a=mp()

l=[0]*(10**5+10)

for x in a:

    l[x]+=1

    l[x-1]+=1

    l[x+1]+=1

print((max(l)))
from collections import Counter

n = int(eval(input()))
l = []
a = list(map(int, input().split()))
for i in range(n):
    l.append(a[i] - 1)
    l.append(a[i])
    l.append(a[i] + 1)
ans = Counter(l)
print((ans.most_common()[0][1]))

import sys
from collections import Counter
from collections import deque


def input():
    return sys.stdin.readline().strip()


def mp():
    return list(map(int, input().split()))


def lmp():
    return list(map(int, input().split()))


n = int(eval(input()))
a = mp()
l = [0] * (10**5 + 10)
for x in a:
    l[x] += 1
    l[x - 1] += 1
    l[x + 1] += 1
print((max(l)))

+import sys +from collections import deque + + +def input(): +    return sys.stdin.readline().strip() + + +def mp(): +    return list(map(int, input().split())) + + +def lmp(): +    return list(map(int, input().split())) + -l = [] -a = list(map(int, input().split())) -for i in range(n): -    l.append(a[i] - 1) -    l.append(a[i]) -    l.append(a[i] + 1) -ans = Counter(l) -print((ans.most_common()[0][1])) +a = mp() +l = [0] * (10**5 + 10) +for x in a: +    l[x] += 1 +    l[x - 1] += 1 +    l[x + 1] += 1 +print((max(l)))