Buggy python submission (verdict: Time Limit Exceeded):
#import sys
#input = sys.stdin.readline
n=int(input())
a=[int(i) for i in input().split()]

#print(a)
ans=0
if n==1:
  ans=1
else:
  for i in range(1,100000+1):
    cnt=0
    for j in a:
      if j==i or j==i-1 or j==i+1:
        cnt+=1
      if ans <= cnt:
        ans = cnt

print(ans)


Fixed submission:
from collections import Counter

#tmp_list = [1, 1, 1, 1, 0, 1, 1]


n=int(input())
a=[int(i) for i in input().split()]
b=[i-1 for i in a]
c=[i+1 for i in a]
d=a+b+c

counter = Counter(d)

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

Buggy python submission (verdict: Time Limit Exceeded):
#import sys
#input = sys.stdin.readline
n=int(input())
a=[int(i) for i in input().split()]

#print(a)
ans=0
if n==1:
  ans=1
else:
  for i in range(1,100000+1):
    cnt=0
    maxa=max(a)
    for j in range(len(a)):
      if a[j]==i or a[j]==i-1 or a[j]==i+1:
        cnt+=1
      if ans <= cnt:
        ans = cnt

print(ans)



Fixed submission:
from collections import Counter

#tmp_list = [1, 1, 1, 1, 0, 1, 1]


n=int(input())
a=[int(i) for i in input().split()]
b=[i-1 for i in a]
c=[i+1 for i in a]
d=a+b+c

counter = Counter(d)

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

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n=int(input())
a=[int(i) for i in input().split()]
b=a
b+=[a[i]-1 for i in range(n)]
b+=[a[i]+1 for i in range(n)]
#print(a)

ans=0
maxa=max(a)
for i in range(1,max(a)+1):
    cnt=b.count(i)
    if ans <= cnt:
      ans = cnt

print(ans)



Fixed submission:
from collections import Counter

#tmp_list = [1, 1, 1, 1, 0, 1, 1]


n=int(input())
a=[int(i) for i in input().split()]
b=[i-1 for i in a]
c=[i+1 for i in a]
d=a+b+c

counter = Counter(d)

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

Buggy python submission (verdict: Time Limit Exceeded):
#import sys
#input = sys.stdin.readline
n=int(input())
a=[int(i) for i in input().split()]
b=a
b+=[a[i]-1 for i in range(n)]
b+=[a[i]+1 for i in range(n)]
#print(a)

ans=0
maxa=max(a)
for i in range(1,max(a)+1):
    cnt=b.count(i)
    if ans <= cnt:
      ans = cnt

print(ans)



Fixed submission:
from collections import Counter

#tmp_list = [1, 1, 1, 1, 0, 1, 1]


n=int(input())
a=[int(i) for i in input().split()]
b=[i-1 for i in a]
c=[i+1 for i in a]
d=a+b+c

counter = Counter(d)

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

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n=int(input())
a=[int(i) for i in input().split()]
#print(a)

ans=0
for i in range(1,100000+1):
    cnt=a.count(i-1)+a.count(i)+a.count(i+1)
    if ans < cnt:
      ans = cnt

print(ans)

Fixed submission:
from collections import Counter

#tmp_list = [1, 1, 1, 1, 0, 1, 1]


n=int(input())
a=[int(i) for i in input().split()]
b=[i-1 for i in a]
c=[i+1 for i in a]
d=a+b+c

counter = Counter(d)

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

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
#print(a)

ans=0
for i in range(1,100000+1):
    cnt=a.count(i-1)+a.count(i)+a.count(i+1)
    if ans < cnt:
      ans = cnt

print(ans)



Fixed submission:
from collections import Counter

#tmp_list = [1, 1, 1, 1, 0, 1, 1]


n=int(input())
a=[int(i) for i in input().split()]
b=[i-1 for i in a]
c=[i+1 for i in a]
d=a+b+c

counter = Counter(d)

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

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
#print(a)

ans=0
for i in range(1,100000+1):
    cnt=a.count(i-1)+a.count(i)+a.count(i+1)
    if ans < cnt:
      ans = cnt

print(ans)



Fixed submission:
from collections import Counter

#tmp_list = [1, 1, 1, 1, 0, 1, 1]


n=int(input())
a=[int(i) for i in input().split()]
b=[i-1 for i in a]
c=[i+1 for i in a]
d=a+b+c

counter = Counter(d)

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