CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))
a_set = set(a)

# aiの各値の個数を数える
a_dict = {}
for i in a_set:
    a_dict[i] = a.count(i)

ans = 0
for i in range(1, 10 ** 5):
    work = 0
    if (i - 1) in a_set:
        work += a_dict[i - 1]
    if i in a_set:
        work += a_dict[i]
    if (i + 1) in a_set:
        work += a_dict[i + 1]
    ans = max(ans, work)

print(ans)

# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))

# ある値がaに存在するとき、その＋ー1の値を足す
## ans_list[-1]となる場合向けにlistは1個余分に値を設けておく
ans_list = [0] * (10 ** 5 + 2)

for i in a:
    ans_list[i] += 1
    ans_list[i + 1] += 1
    ans_list[i - 1] += 1

ans = max(ans_list)

print(ans)
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))
b = [a.count(i) for i in range(10 ** 5 + 1)]
ans = 0
for i in range(1, 10 ** 5):
    ans = max(ans, b[i-1] + b[i] + b[i+1])
print(ans)

# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))
b = [0 for i in range(10 ** 5 + 1)]
d = {}

for key in a:
    if key in d:
        d[key] += 1
    else:
        d[key] = 1

ans = 0
for i in range(10 ** 5 + 1):
    if i in d:
        b[i] = d[i]

for i in range(1, 10 ** 5):
    ans = max(ans, b[i-1] + b[i] + b[i+1])
print(ans)
# Original solution
# C
n = int(eval(input()))
l = list(map(int, input().split()))

m = 0
for i in range(1, 10**5):
    if m < l.count(i-1)+l.count(i)+l.count(i+1):
        m = l.count(i-1)+l.count(i)+l.count(i+1)
        
print(m)

# Optimized solution
# C
n = int(eval(input()))
a = list(map(int, input().split()))

l = [0]*(10**5+10)
for i in range(n):
    l[a[i]] += 1
    
s = 0
for j in range(1, len(l)-1):
    if  s < l[j-1] + l[j] + l[j+1]:
        s = l[j-1] + l[j] + l[j+1]
        
print(s)
# Original solution
from collections import Counter
eval(input())
A = list(map(int, input().split()))
C = Counter(A)
def get(i): return C[i] if i in C else 0
print((max(sum(get(x) for x in range(i-1,i+2)) for i in range(10**5))))

# Optimized solution
N,*A=list(map(int, open(0).read().split()))
C=[0]*(10**5+5)
for a in A:
    C[a-1]+=1
    C[a]+=1
    C[a+1]+=1
print((max(C[i] for i in range(10**5+1))))
# Original solution
from collections import Counter
 
n = int(eval(input()))
a = list(map(int,input().split()))
 
ac = Counter(a)
 
m = max(a)
ans = 0
for i in range(1,m+10):
    ans = max(ans, ac[i-1]+ac[i]+ac[i+1])
print(ans)

# Optimized solution
from collections import Counter
 
n = int(eval(input()))
a = list(map(int,input().split()))
 
ac = Counter(a)
 
m = max(a)
ans = 0
for i in range(m+1):
    ans = max(ans, ac[i-1]+ac[i]+ac[i+1])
print(ans)
# Original solution
N = int(eval(input()))
A = (10**5+2)*[0]

for a in map(int,input().split()):
  A[a-1]+=1
  A[a]+=1
  A[a+1]+=1

print((max(A)))

# Optimized solution
N = int(eval(input()))
A = 100002*[0]

for a in map(int,input().split()):
  A[a-1]+=1
  A[a]+=1
  A[a+1]+=1

print((max(A)))
# Original solution
from collections import Counter
N = int(eval(input()))
src = list(map(int,input().split()))
ctr = Counter(src)

mx = max(src)
ans = 0
for i in range(mx+1):
    ans = max(ans, ctr[i] + ctr[i+1] + ctr[i+2])
print(ans)


# Optimized solution
N = int(eval(input()))
src = list(map(int,input().split()))
mem = [0] * (10**5+2)
for a in src:
    mem[a] += 1
    mem[a+1] += 1
    mem[a+2] += 1
print((max(mem)))
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)
ans = 0
for i in range(10**5):
    tmp = ctr[i-1] + ctr[i] + ctr[i+1]
    ans = max(ans,tmp)
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))

from collections import Counter
ctr = Counter(A)
ans = 0
for i in range(10**5+1):
    t = ctr[i-1] + ctr[i] + ctr[i+1]
    ans = max(ans,t)
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

from collections import Counter
ctr = Counter(A)
ans = 0
for i in range(10**5+1):
    t = ctr[i-1] + ctr[i] + ctr[i+1]
    ans = max(ans,t)
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)

ans = 0
for x in range(10**5+2):
    t = ctr[x-1] + ctr[x] + ctr[x+1]
    ans = max(t,ans)
print(ans)
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))

cnt = 0
X = []

for k in a:
    X.append(k+1)
    X.append(k)
    X.append(k-1)

for i in X:
    tmplist = []
    for j in a:
        tmplist.append(i-j)
        if cnt < tmplist.count(1) + tmplist.count(0) + tmplist.count(-1):
            cnt = tmplist.count(1) + tmplist.count(0) + tmplist.count(-1)

print(cnt)

# Optimized solution
# 辞書を用意して最大値を取得する

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

cnt = {}

for i in a:
    for j in [-1,0,1]:
        cnt.setdefault(i+j, 0)
        cnt[i+j] += 1

print((max(cnt.values())))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

num_list = [0] * (max(a) + 2)

for i in range(n):
    num_list[a[i]] += 1
    if i == n:
        continue
    elif a[i] == 0:
        continue
    else:
        num_list[a[i]-1] += 1
    if i == 0 or a[i] == max(a):
        continue
    else:
        num_list[a[i]+1] += 1

print((max(num_list)))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

t = max(a)
num_list = [0] * (t + 2)

for i in range(n):
    num_list[a[i]] += 1
    if a[i] == 0:
        continue
    else:
        num_list[a[i]-1] += 1
    if a[i] == t:
        continue
    else:
        num_list[a[i]+1] += 1

print((max(num_list)))
# Original solution
n=int(eval(input()))
ans=0
hoge=list(map(int,input().split()))
for i in range(100000):
  huga=hoge.count(i-1)+hoge.count(i)+hoge.count(i+1)
  if(huga>=ans):
    ans=huga
print(ans)

# Optimized solution
n=int(eval(input()))
hoge=list(map(int,input().split()))
huga=[0]*(10**5+1)
for i in hoge:
  if(i==10**5):
    huga[i-1]+=1
    huga[i]+=1
  elif(i==0):
    huga[i]+=1
    huga[i+1]+=1
  else:
    huga[i-1]+=1
    huga[i]+=1
    huga[i+1]+=1
print((max(huga)))
# Original solution
from collections import Counter

N = int(eval(input()))
input_list = sorted([int(i) for i in input().split()])
inupt_dict = (Counter(input_list))
result = 0
input_dict_keys = list(inupt_dict.keys())

if N == 1:
    result = 1
elif N == 2 and input_list[0] == input_list[1]:
    result = 2
elif N == 2 and input_list[0] != input_list[1]:
    if input_list[1] == input_list[0] + 1:
        result = 2
    else:
        result = 1
else:
    for i in range(N-2):
        if i in input_dict_keys:
            if i+1 in input_dict_keys:
                if i+2 in input_dict_keys:
                    result = max(result, (inupt_dict[i] + inupt_dict[i+1] + inupt_dict[i+2]))

        for i in range(N-1):
            if i in input_dict_keys:
                if i+1 in input_dict_keys:
                    result = max(result, (inupt_dict[i] + inupt_dict[i+1]))

        for i in range(N):
            if i in input_dict_keys:
                result = max(result, inupt_dict[i])


print(result)

# Optimized solution
from collections import Counter

N = int(eval(input()))
input_list = sorted([int(i) for i in input().split()])
inupt_dict = (Counter(input_list))
result = 0
input_dict_keys = list(inupt_dict.keys())

if N == 1:
    result = 1
elif N == 2 and input_list[0] == input_list[1]:
    result = 2
elif N == 2 and input_list[0] != input_list[1]:
    if input_list[1] == input_list[0] + 1:
        result = 2
    else:
        result = 1
else:
    for i in range(N-2):
        if i in input_dict_keys:
            if i+1 in input_dict_keys:
                if i+2 in input_dict_keys:
                    result = max(result, (inupt_dict[i] + inupt_dict[i+1] + inupt_dict[i+2]))
    for i in range(N-1):
        if i in input_dict_keys:
            if i+1 in input_dict_keys:
                result = max(result, (inupt_dict[i] + inupt_dict[i+1]))
    for i in range(N):
        if i in input_dict_keys:
            result = max(result, inupt_dict[i])

print(result)
# Original solution
import collections
N = int(eval(input()))
a = (list(map(int, input().split())))
for i in range(N):
    a.append(a[i] - 1)
    a.append(a[i] + 1)
c = collections.Counter(a)
print((c.most_common()[0][1]))


# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))
A = [0] * (10 ** 5 + 5)
for ai in a:
    A[ai - 1] += 1
    A[ai] += 1
    A[ai + 1] += 1
print((max(A)))
# Original solution
from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))
 
C = Counter(A)
ans = 0
for i in range(10**5):
  c = C[i-1] + C[i] + C[i+1]
  ans = max(c,ans)
  
print(ans)

# Optimized solution
import collections
n = int(eval(input()))
a = list(map(int,input().split()))
lst = collections.defaultdict(int)
for i in a:
  lst[i] += 1
  lst[i-1] += 1
  lst[i+1] += 1
  
lst = sorted(list(lst.items()),reverse=True,key=lambda x:x[1])
print((lst[0][1]))
# Original solution
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ca = Counter(a)
maxa = a[-1]
mina = a[0]
ans = 0
for i in range(mina, maxa+1):
  cnt = sum([v for k, v in list(ca.items()) if i - 1 <= k <= i + 1])
  if ans < cnt:
    ans = cnt
print(ans)

# Optimized solution
eval(input())
C = [0] * 100002
for i in map(int, input().split()):
  C[i - 1] += 1
  C[i] += 1
  C[i + 1] += 1
print((max(C)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

setA = set(A)

ans = 0
c = 0
for x in setA:
    for a in A:
        if a == x-1 or a == x or a == x+1:
            c += 1
    ans = max(ans, c)
    c = 0
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

DA = {}
for a in A:
    if a in list(DA.keys()):
        DA[a] += 1
    else:
        DA[a] = 1

ans = 0
c = 0
for k, v in list(DA.items()):
    c += v
    if k+1 in DA:
        c += DA[k+1]
    if k-1 in DA:
        c += DA[k-1]
    ans = max(ans, c)
    c = 0
print(ans)
# Original solution
from collections import Counter

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

ans = 0
c = Counter(a).most_common()
for i in range(min(a), max(a) + 1):
    temp = [value if abs(i - key) <= 1 else 0 for key, value in c]
    ans = max(ans, sum(temp))

print(ans)


# Optimized solution
from collections import Counter

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

x = []
for i in a:
    x.append(i)
    x.append(i + 1)
    x.append(i - 1)

ans = max(Counter(x).values())
print(ans)
# Original solution
n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0

for i in range(0, 10**5+1):
  count = 0
  for j in l:
    if j == i or j == i+1 or j == i-1:
      count += 1
  if count > ans:
    ans = count

print(ans)

# Optimized solution
n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
count = {}
for i in range(0, 10**5+1):
  count[i] = 0

for i in l:
  count[i] = count[i] + 1

for i in range(0, 10**5+1):
  if i == 0:
    temp = count[i] + count[i+1]
  elif i == 10**5:
    temp = count[i] + count[i-1]
  else:
    temp = count[i] + count[i+1] + count[i-1]

  if temp > ans:
    ans = temp

print(ans)
# Original solution
from sys import stdin
import sys
import math

n = int(eval(input()))
#a = list(map(int, stdin.readline().rstrip().split()))
a = sorted(list(map(int, stdin.readline().rstrip().split())))


count_max = 1

count_prev = 0
count_curr = 1
count_next = 0

current_value = a[0]
for i in range(1, n):
    if a[i] == current_value:
        count_curr += 1
    elif a[i] == current_value + 1:
        count_next += 1
    elif a[i] == current_value + 2:
        count_max = max(count_max, (count_prev + count_curr + count_next))
        current_value = current_value + 1
        count_prev = count_curr
        count_curr = count_next
        count_next = 1
    elif a[i] >= current_value + 3:
        count_max = max(count_max, (count_prev + count_curr + count_next))
        current_value = a[i]
        count_prev = 0
        count_curr = 1
        count_next = 0
    else:
        print("Error")

count_max = max(count_max, (count_prev + count_curr + count_next))

print(count_max)


# Optimized solution
from sys import stdin
import sys
import math

n = int(eval(input()))
a = list(map(int, stdin.readline().rstrip().split()))

dict_count = {}
for i in a:
    dict_count[i] = 0

for j in a:
    dict_count[j] += 1

#print(dict_count)

max_count = 0

for key in list(dict_count.keys()):
    max_count = max(max_count, dict_count.get(key - 1, 0) + dict_count.get(key, 0) + dict_count.get(key + 1, 0))

print(max_count)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0 for _ in range(10**5 + 2)]
for i in a:
    ans[i] += 1
    ans[i+1] += 1
    ans[i-1] += 1
print((max(ans)))

# Optimized solution
n = int(eval(input()))
l = list(map(int,input().split()))
l0 = [0]*(10**5+2)
for i in l:
    l0[i] += 1
    l0[i+1] += 1
    l0[i-1] += 1
print((max(l0)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
count_list = []
for i in range(10**5):
  count_list.append(A.count(i))
Max = 0
for i in range(10**5-2):
  Max = max(Max, count_list[i]+count_list[i+1]+count_list[i+2])
print(Max)
  

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
count_list = [0]*10**5
for i in range(N):
  count_list[A[i]] += 1
Max = 0
for i in range(10**5-2):
  Max = max(Max, count_list[i]+count_list[i+1]+count_list[i+2])
print(Max)
# Original solution
from collections import Counter

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

for i in range(N):
    a.append(a[i]+1)
    a.append(a[i]-1)

ans = Counter(a)

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

# Optimized solution
from collections import defaultdict

n = int(eval(input()))
arr = list(map(int, input().split()))

d = defaultdict(int)

for x in arr:
    d[x] += 1
    d[x - 1] += 1
    d[x + 1] += 1

result = [y for x, y in list(d.items())]

print((max(result)))
# Original solution
from collections import defaultdict

n = int(eval(input()))
arr = list(map(int, input().split()))

d = defaultdict(int)

for x in arr:
    d[x] += 1
    d[x - 1] += 1
    d[x + 1] += 1

result = [y for x, y in list(d.items())]

print((max(result)))

# Optimized solution
from collections import defaultdict

n = int(eval(input()))
arr = list(map(int, input().split()))

d = defaultdict(int)
for x in arr:
    d[x] += 1

a = d[0] + d[1] + d[2]
ans = [a]

for i in range(max(arr) - 2):
    a -= d[i]
    a += d[i + 3]
    ans.append(a)

print((max(ans)))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
r=a[:]
r.extend([i-1 for i in a])
r.extend([i+1 for i in a])
for i in set(r):
  x=0
  for ai in a:
    if ai==i or ai-1==i or ai+1==i:
      x+=1
  ans=max(ans,x)
print(ans)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
an = [0]*(max(a)+2)
for i in a:
  if i!=0:
    an[i-1]+=1
  an[i+1]+=1
  an[i]+=1
print((max(an)))
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
         
number_of_items=[]
for X in range(min(A)-1, max(A)+1):
    number_of_items.append(A.count(X)+A.count(X-1)+A.count(X+1))
print((max(number_of_items)))

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
bucket=[0]*(max(A)+1)
answer=0
for number in A:
    bucket[number]+=1
if len(bucket)<3:
    answer=sum(bucket)
for i in range(1,max(A)):
    candidate=bucket[i-1]+bucket[i]+bucket[i+1]
    if candidate>answer:
        answer=candidate
print(answer)
# Original solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

max_count = 0

for X in range(1, 10**5):
    count = 0
    for i in A:
        if X-1 <= i <= X+1:
            count += 1
        if count > max_count:
            max_count = count

print(max_count)

# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]
A_count = [0] * (max(A)+1)

for i in A:
    A_count[i] += 1

max_count = 0
if len(A_count) < 4:
    print((sum(A_count)))
else:
    for X in range(1, len(A_count)-1):
        count = A_count[X-1] + A_count[X] + A_count[X+1]
        if count > max_count:
            max_count = count
    print(max_count)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

nums = [0]*(10**5+10)
for a in A:
  nums[a] += 1
  nums[a-1] += 1
  nums[a+1] += 1
print((max(nums)))

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))

result = [0]*(10**5+10)
for a in A:
  result[a] += 1
  result[a-1] += 1
  result[a+1] += 1
print((max(result)))
# Original solution
N = int(eval(input()))
a = [int(c) for c in input().split()]
#ループしてX候補を求める
ma = 0
tmp = 0
for i in range(N):
    tmp = a.count(a[i]-1)+a.count(a[i])+a.count(a[i]+1)
    if ma < tmp:
        ma = tmp
print(ma)

# Optimized solution
N = int(eval(input()))
a = sorted([int(c) for c in input().split()])
#2回の変わり目を記憶
c1,c2,c3 = [0,0,0]
ma = 1
for i in range(N):
    if i > 0:
        if a[i]==a[i-1]+1:
            c1 = c2 
            c2 = c3
            c3 = i
        elif a[i]!=a[i-1]:
            c1,c2,c3=[i,i,i]
    if ma < i - c1+1:
        ma = i - c1+1

print(ma)
# Original solution
n = int(eval(input()))
a_list = list(map(int, input().split()))
nums = set(a_list)
r_list = [0]*(10**5+2)
for n in nums:
	count = a_list.count(n)
	r_list[n] += count
	r_list[n+1] += count
	if n > 0:
		r_list[n-1] += count
print((max(r_list)))

# Optimized solution
n = int(eval(input()))
a_list = list(map(int, input().split()))
r_list = [0]*(10**5+2)
for n in a_list:
	r_list[n] += 1
	r_list[n+1] += 1
	if n > 0:
		r_list[n-1] += 1
print((max(r_list)))
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
check = [0]*((10**5)+1)
for i in a:check[i] += 1
ans = check[0] + check[1]
for i in range(len(check)-2):ans = max(ans,check[i]+check[i+1]+check[i+2])
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
count = [0]*(10**5+5)
for v in a:
    count[v] += 1

maxX = 0
maxV = 0

for i in range(10**5+1):
    val = count[i-1] + count[i] + count[i+1]
    if val > maxV:
        maxV = val
        maxX = i
print(maxV)
# Original solution
import collections

n = int(eval(input()))
m = list(map(int,input().split()))

zen = m
cou = 0

for x in range(n):
    zen.append(m[x]-1)

for x in range(n):
    zen.append(m[x]+1)

a = collections.Counter(zen)

for k in range(n):
    if a.most_common()[0][0] == m[k] or a.most_common()[0][0] == m[k] -1 or a.most_common()[0][0] == m[k] +1:
        cou += 1

print(cou)

# Optimized solution
import collections

n = int(eval(input()))
m = list(map(int,input().split()))

zen = m
cou = 0

for x in range(n):
    zen.append(m[x]-1)

for x in range(n):
    zen.append(m[x]+1)

a = collections.Counter(zen)

#for k in range(n):
#    if a.most_common()[0][0] == m[k] or a.most_common()[0][0] == m[k] -1 or a.most_common()[0][0] == m[k] +1:
#        cou += 1

print((a.most_common()[0][1]))
# Original solution
from collections import Counter



def main()->None:
    N = int(eval(input()))
    a = list(map(int, input().split()))
    a_dict = Counter(a)
    keys = list(a_dict.keys())
    max_count = 0
    for key in keys:
        tmp_count = 0
        for i in keys:
            if key + 1 == i or key - 1 == i or key == i:
                tmp_count += a_dict[i]
        if tmp_count > max_count:
            max_count = tmp_count
    print(max_count)

if __name__ == "__main__":
    main()
   

# Optimized solution
import sys


def main()->None:
    N = int(sys.stdin.readline())
    a = list(map(int, sys.stdin.readline().split()))
    max_a = max(a)
    # print(max_a)
    l = [0 for _ in range(max_a+2)] # 配列の初期化、固定長、位置が配列の数字で要素がカウント
    for i in a:
        l[i] += 1
    res = 0
    for i in range(0, max_a+1):
        tmp = l[i-1]+l[i]+l[i+1]
        res = max(res, tmp)
    print(res)


if __name__ == "__main__":
    main()
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
candidates=set()
for i in range(len(A)):
  candidates.add(A[i])
  candidates.add(A[i]-1)
  candidates.add(A[i]+1)

# 渡された配列内に，±1で数xに出来る数がいくつあるか判定
def neigh(array, x):
  cnt = 0
  for a in array:
    if a == x:
      cnt+=1
    elif a-1 == x:
      cnt+=1
    elif a+1 == x:
      cnt+=1
  return cnt

res=[]
for c in candidates:
  res.append(neigh(A,c))
  
print((max(res)))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

cnt=dict()
# a内の数とその±1をdict型の配列に入れながら個数をカウント
for a in A:
  cnt[a] = cnt.setdefault(a,0) + 1
  cnt[a-1] = cnt.setdefault(a-1,0) + 1
  cnt[a+1] = cnt.setdefault(a+1,0) + 1
  
  
# カウントした数字で昇順にソート  
cnt_sort = sorted(list(cnt.items()), key=lambda x:x[1])
cnt_sort.reverse()

print((cnt_sort[0][1]))
# Original solution
from collections import Counter

N = int(eval(input()))
a = list(map(int, input().split()))
ac = Counter(a)
ans = 0

for i in list(ac.keys()):
    ans = max(ans, ac[i] + ac[i + 1] + ac[i - 1])

print(ans)

# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * (10 ** 5 + 2)

for i in a:
    b[i - 1] += 1
    b[i] += 1
    b[i + 1] += 1
print((max(b)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

L = [0 for i in range(max(A) + 1)]

for a in A:
    L[a] += 1
    if a != 0:
        L[a - 1] += 1
    if a != max(A):
        L[a + 1] += 1

print((max(L)))




# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

L = [0 for i in range(max(A) + 10)]

for a in A:
    L[a] += 1
    L[a - 1] += 1
    L[a + 1] += 1

print((max(L)))
# Original solution
import collections
N = int(eval(input()))
A = [int(T) for T in input().split()]
Num = [0]*(max(A)-min(A)+3)
for T in range(0,N):
    Num[A[T]-min(A)+1] += 1
MAX = 0
for T in range(0,max(A)-min(A)+1):
    if MAX<sum(Num[T:T+3]):
        MAX = sum(Num[T:T+3])
print(MAX)

# Optimized solution
import collections
N = int(eval(input()))
Num,Count = list(zip(*sorted(collections.Counter(int(T) for T in input().split()).most_common())))
DisN = ((min(Num)-1),)+Num+((max(Num)+1),)
DisC = (0,)+Count+(0,)
MAX = 0
for T in range(1,len(Num)+1):
    Dis = DisC[T]
    if DisN[T-1]==DisN[T]-1:
        Dis += DisC[T-1]
    if DisN[T+1]==DisN[T]+1:
        Dis += DisC[T+1]
    if MAX<Dis:
        MAX = Dis
print(MAX)
# Original solution
import collections

n = int(eval(input()))
a = list(map(int, input().split()))
s =set(a)
ans = []

for x in s:
    x -= 1
    for _ in range(2):
        l = []
        x += 1
        for i in a:
            if i == x - 1:
                l.append(i+1)
            elif i == x:
                l.append(i)
            elif i == x + 1:
                l.append(i-1)
                
        c = collections.Counter(l).most_common(1)
        ans.append(c[0][1])

print((max(ans)))

# Optimized solution
from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
sa =set(a)
ca = Counter(a)
ans = 0

for x in sa:
    # カウンタオブジェクトは存在しない要素に０を返す
    tmp = ca[x-1] + ca[x] + ca[x+1]
    if ans < tmp:
        ans = tmp

print(ans)
# Original solution
import collections

n = int(eval(input()))
A = list(map(int, input().split()))

x = []
x_append = x.append

for a in A:
    x_append(a-1)
    x_append(a)
    x_append(a+1)
    
X = collections.Counter(x)

print((X.most_common()[0][1]))

# Optimized solution
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))

B = []
for a in A:
    B.append(a-1)
    B.append(a)
    B.append(a+1)
C = Counter(B)

print((C.most_common()[0][1]))
# Original solution
# -*- coding: utf-8 -*-
import collections
n = int(eval(input()))
a = [int(i) for i in input().split()]

ans = 0
c = collections.Counter(a)
#print(c)
#print(set(a))
b = list(set(a))
for i in range(len(b)):
    tmp = c[b[i] - 1] + c[b[i]] + c[b[i] + 1]
    #print(tmp)
    if ans < tmp:
        ans = tmp
print(ans)


# Optimized solution
# -*- coding: utf-8 -*-
import collections
n = int(eval(input()))
a = [int(i) for i in input().split()]

ans = 0
c = collections.Counter(a)
b = list(set(a))
for i in range(len(b)):
    tmp = c[b[i] - 1] + c[b[i]] + c[b[i] + 1]
    if tmp > ans:
        ans = tmp
print(ans)