Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
l = [int(input()) for i in range(5)]
m = [n,0,0,0,0,0]
cnt = 0
while sum(m[0:5]):
    if cnt>=4 and m[4]-l[4]>0:
        m[4]-=l[4]
        m[5]+=l[4]
    elif cnt>=4 and not(m[4]-l[4]>0):
        m[5]+=m[4]
        m[4]=0
    if cnt>=3 and m[3]-l[3]>0:
        m[3]-=l[3]
        m[4]+=l[3]
    elif cnt>=3 and not(m[3]-l[3]>0):
        m[4]+=m[3]
        m[3]=0
    if cnt>=2 and m[2]-l[2]>0:
        m[2]-=l[2]
        m[3]+=l[2]
    elif cnt>=2 and not(m[2]-l[2]>0):
        m[3]+=m[2]
        m[2]=0
    if cnt>=1 and m[1]-l[1]>0:
        m[1]-=l[1]
        m[2]+=l[1]
    elif cnt>=1 and not(m[1]-l[1]>0):
        m[2]+=m[1]
        m[1]=0
    if cnt>=0 and m[0]-l[0]>0:
        m[0]-=l[0]
        m[1]+=l[0]
    elif cnt>=0 and not(m[0]-l[0]>0):
        m[1]+=m[0]
        m[0]=0
    cnt+=1
print(cnt)

### FIXED CODE ###

n = int(input())
l = [int(input()) for i in range(5)]
r = min(l)
h = -(-n//r)
print(4+h)
### BUGGY CODE ###

N=int(input())
P=list(map(int,input().split()))
count=0
for i in range(1,N):
    num = 0
    j=0
    while j<i and  P[i]<=P[j]:
        num+=1
        j+=1
    if num==i:
        count+=1
print(count+1)


### FIXED CODE ###

N=int(input())
P=list(map(int,input().split()))
count=0
min=2*10**5
for i in range(N):
    if P[i]<=min:
        min=P[i]
        count+=1
print(count)
### BUGGY CODE ###

N = int(input())
A = [int(a) for a in input().split()]
s = 1
for a in A:
    s *= a
print(s if s <= 10 ** 18 else -1)

### FIXED CODE ###

N = int(input())
s = 1
A = sorted([int(a) for a in input().split()])
for a in A:
    s *= a
    if s > 10 ** 18:
        print(-1)
        break
else:
    print(s)
### BUGGY CODE ###


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    h,w=map(int,input().split())
    ls=[input() for _ in range(h)]
    s=[[] for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if ls[i][j]=="#":
                s[i].append(1)
            else:
                s[i].append(0)

    u=UnionFind(h*w)

    for i in range(h):
        for j in range(w):
            if j !=0:
                if s[i][j-1] != s[i][j]:
                    u.union(i*w+j-1,i*w+j)
                    u.find(i*w+j)
            if i !=0:
                if s[i-1][j] != s[i][j]:
                    u.union((i-1)*w+j,i*w+j)
                    u.find(i*w+j)
    res = 0
    for i in range(h*w):
        for j in range(i,h*w):
            if s[i//w][i%w] != s[j//w][j%w]:
                if u.same(i,j):
                    res += 1
    print(res)

main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

h,w=map(int,input().split())
s=[input() for _ in range(h)]
flag = [[0]*w for _ in range(h)]

def dfs(th,tw):
    global flag,h,w,s
    flag[th][tw] = True
    tblack = 0
    twhite = 0
    if s[th][tw] == "#":
        tblack += 1
    else:
        twhite += 1 
    for x,y in ([0,1],[0,-1],[1,0],[-1,0]):
        nth = th + x
        ntw = tw + y
        if nth >= 0 and nth < h and ntw >= 0 and ntw < w:
            if not flag[nth][ntw] and s[th][tw] != s[nth][ntw]:
                ttb,ttw = dfs(nth,ntw)
                tblack += ttb
                twhite += ttw
    return [tblack,twhite]
                
def main():
    global flag,h,w,s
    res = 0
    for i in range(h):
        for j in range(w):
            if not flag[i][j]:
                black,white = dfs(i,j)
                res += black * white 

    return res
print(main())
### BUGGY CODE ###

import numpy as np
N, K = map(int, input().split())
h = [int(x) for x in input().split()]

cost = np.full(N, float("inf"))
cost[0] = 0

for i in range(1, N):
    hi_cost = h[i]
    min_cost = float("inf")
    for j in range(max(0, i-K), i):
        _cost = abs(hi_cost - h[j]) + cost[j]
        min_cost = _cost if _cost < min_cost else min_cost
    cost[i] = min_cost
    
print(int(cost[N-1]))

### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
hights = np.array(list(map(int,input().split())))
steps=np.array([0]*N)
steps[0]=0

for i in range(1, N):
    gaps = hights[max(0, i-K):i] - hights[i]
    gaps = np.abs(gaps)
    gaps += steps[max(0, i-K):i]
    steps[i] = np.min(gaps)
    
print(int(steps[N-1]))
### BUGGY CODE ###

def f(d):
    try:
        return stored[(d[0],d[1],d[2])]
    except:
        if d[1]<0 or d[2]<0 or d[0]<0:
            return 0
        pass
    ans = n/(d[0]+d[1]+d[2]) + (d[2]/(d[0]+d[1]+d[2]))*f([d[0],d[1]+1,d[2]-1]) + (d[1]/(d[0]+d[1]+d[2]))*f([d[0]+1,d[1]-1,d[2]]) + (d[0]/(d[0]+d[1]+d[2]))*f([d[0]-1,d[1],d[2]])
    stored[(d[0],d[1],d[2])] = ans
    return ans
 
 
n = int(input())
a = list(map(int,input().split()))
d = [0 for i in range(3)]
stored = {(0,0,0):0}
for i in a:
    d[i-1] +=1
print(f(d))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
d = [0 for i in range(3)]
dp = [[[0 for i in range(n+1)] for j in range(n+1)] for k in range(n+1)] 
for i in a:
    d[i-1] +=1
for k in range(n+1):
    for j in range(n+1):
        for i in range(n+1):
            if i+j+k==0 or i+j+k>n:
                continue
            ans = n/(i+j+k)
            x = i/(i+j+k)
            if x:
                ans += x*dp[k][j][i-1]
            x = j/(i+j+k)
            if x:
                ans += x*dp[k][j-1][i+1]
            x = k/(i+j+k)
            if x:
                ans += x*dp[k-1][j+1][i]
            dp[k][j][i] = ans
print(dp[d[2]][d[1]][d[0]])
### BUGGY CODE ###

def main():
    import sys
    from collections import deque
    from sys import stdin
    readline = stdin.readline

    n,m = map(int, readline().split())
    abl =[[]for i in range(n)]
    for i in range(m):
        a,b = map(int,readline().split())
        abl[a-1].append(b)
        abl[b-1].append(a)
    
    an=[0]*(n-1)
    i=1
    wk=deque([i])
    wwk=deque([])
    il=deque(abl[0])

    while any(wk):
        i=wk.pop()
        il=deque(abl[i-1])
        lil=len(il)
        for k in range(lil):
            iwk=il.pop()
            if an[iwk-2]==0 and iwk>1:
                wwk.append(iwk)
                an[iwk-2]=i
                if all(an):
                    print('Yes')
                    for i in an:
                        print(i)
                    sys.exit()
        if not(any(wk)):
            wk=deque(wwk)
            wwk=deque([])
    print('No')

main()

### FIXED CODE ###

def main():
    from collections import deque
 
    n,m =map(int,input().split())
    abl=[[] for i in range(n+1)]
    for i in range(m):
        a,b = map(int,input().split())
        abl[a].append(b)
        abl[b].append(a)
 
    an=[0]*(n+1)
    an[0]=1
    tg = deque([1])
    while len(tg):
        itg = tg.popleft()
        for j in abl[itg]:
            if an[j]==0:
                an[j]=itg
                tg.append(j)

    if all(an):
        print('Yes')
        for j in an[2:]:
            print(j)
    else:
        print('No')
 
main()
### BUGGY CODE ###

import collections
N, K = map(int, raw_input().split())
P_list = list()
for i in range(N):
    P_list.append(raw_input()[0])
    C_list = collections.Counter(P_list).values()
 
# clean
C_list = [c for c in C_list if c > 0]
C_list.sort(reverse=True)
 
res = 0
while True:
    if len(C_list) >= K:
        for i in range(K):
            C_list[i] -= 1
        res += 1
        C_list = [c for c in C_list if c > 0]
        C_list.sort(reverse=True)
    else:
        break
print res

### FIXED CODE ###

import numpy as np
C_vec = np.zeros(26)
N, K = map(int, raw_input().split())

for i in range(N):
    C_vec[ord((raw_input()[0])) - ord('A')] += 1


while True:
    m = int(C_vec.sum() / K)
    C_vec = np.minimum(C_vec, m)
    m_next = int(C_vec.sum() / K)
    if m_next == m:
        break
    else:
        m = m_next

print m
### BUGGY CODE ###

n,K,Q = input().split()
CAList = []
AllP = []
for i in range(0,int(Q)):
    CAList.append(input())

for j in range(0,int(n)):
    AllP.append(int(K))

for k in range(0,int(Q)):
    box = AllP[int(CAList[k])-1]
    for l in range(0,int(n)):
        AllP[l] = AllP[l] - 1
    AllP[int(CAList[k])-1] = box
    
for m in range(0,int(n)):
    if AllP[m] >= 1:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

a,b,c = input().split()
n = int(a)
K = int(b)
Q = int(c)
CAList = []
AllP = []
for i in range(0,Q):
    CAList.append(int(input()))

for j in range(0,n):
    AllP.append(K-Q)

for k in range(0,Q):
    AllP[CAList[k]-1] += 1
    
for m in range(0,n):
    if AllP[m] >= 1:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

from collections import deque
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def cnt(c,d):
    if (0 <= c < H) and (0 <= d < W):
        return grid[c][d]
    else:
        return MAX_INT
def tami(a,b):
    num = min(cnt(a+1,b),cnt(a,b+1),cnt(a-1,b),cnt(a,b-1))
    return num+1

H,W = IL()
A = [[i for i in S()] for i in range(H)]

grid = [[MAX_INT]*W for i in range(H)]

for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            grid[i][j] = 0

for i in range(H):
    for j in range(W):
        if grid[i][j] != 0:
            grid[i][j] = tami(i,j)

for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if grid[i][j] != 0:
            grid[i][j] = tami(i,j)

ans = 0
for i in range(H):
    ans = max(ans,max(grid[i][:]))
    
print(ans)


### FIXED CODE ###

MAX_INT = int(10e10)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def cnt(c,d):
    if (0 <= c < H) and (0 <= d < W):
        return grid[c][d]
    else:
        return MAX_INT
def tami(a,b):
    num = min(cnt(a+1,b),cnt(a,b+1),cnt(a-1,b),cnt(a,b-1))
    return num+1

H,W = IL()
A = [[i for i in S()] for i in range(H)]

grid = [[MAX_INT]*W for i in range(H)]

for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            grid[i][j] = 0

for i in range(H):
    for j in range(W):
        if grid[i][j] != 0:
            grid[i][j] = tami(i,j)

for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if grid[i][j] != 0:
            grid[i][j] = tami(i,j)

ans = 0
for i in range(H):
    ans = max(ans,max(grid[i][:]))

print(ans)
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input()
l = []
for i in range(Q):
    a, b = map(int, input().split())
    ps = S[a-1: b]
    num = ps.count('AC')
    print(num)


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

pos = [0] * N
i = 0
while i < N-1:
    if S[i] == 'A':
        if S[i+1] == 'C':
            pos[i+1] = 1
    i += 1

nums = [0] * (N+1)
for i in range(1, N+1):
    nums[i] += nums[i-1] + pos[i-1]

for _ in range(Q):
    l, r = map(int, input().split())
    print(nums[r]-nums[l])
### BUGGY CODE ###

a=int(input())
l=list(map(int,input().split()))
b=int(input())
for i in range(b):
  l1=list(map(int,input().split()))
  for i in range(len(l)):
    if l[i] ==l1[0]:
      l[i]=l1[1]
  print(sum(l))

### FIXED CODE ###

from collections import Counter
a=int(input())
l=list(map(int,input().split()))
b=int(input())
s=Counter(l)
initial_sum=sum(l)

for _ in range(b):
  x,y=map(int,input().split())
  k=s[x]
  s[x]=0
  s[y]+=k
  initial_sum+=(y-x)*k
  print(initial_sum)
### BUGGY CODE ###

n,k,q = list(map(int, input().split()))
a = [int(input()) for _ in range(q)]

b = ["No"]*n

for i in range(n):
    if k - q + a.count(i+1) > 0 :
        b[i] = "Yes"

for i in range(n):
    print(b[i])

### FIXED CODE ###

n,k,q = list(map(int, input().split()))
a = [0]*n
for i in range(q):
    tmp = int(input())
    a[tmp-1] += 1

b = ["No"]*n
    

for i in range(n):
    if k - q + a[i] > 0 :
        b[i] = "Yes"

for i in range(n):
    print(b[i])
### BUGGY CODE ###

def count_ans(n,a):
    n = len(a)
    count = 0
    
    for l in range(n):
        sum_from_l = 0
        r = l
        while r < n:
            if sum_from_l & a[r] == 0:
                sum_from_l += a[r]
                count += 1
                r += 1
            else:
                break
            
    return count



def main():
    
    #0. input
    n = int(input())
    a = list(map(int, input().split()))
    
    #1. judge
    ans = count_ans(n,a)
    print(ans)



if __name__ == "__main__":
    main()

### FIXED CODE ###

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

ans = 0
total = 0
right = 1
for left in range(N):
    while right < N+1:
        cur = A[right-1]
        if total & cur == 0:
            right += 1
            total += cur
        else:
            total -= A[left]
            break
        
        ans += right-left-1

        
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque

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

L=[]
chk=[0 for _ in range(N)]
tmp=0
while(1):
    if chk[tmp]==1:
        break
    chk[tmp]=1
    L.append(tmp)
    tmp=A[tmp]-1

loop_s=A[L[-1]-1]-1
loop_g=L[-1]-1
one_to_s=0
tmp=0
while(1):
    if tmp==loop_s:
        break
    tmp=A[tmp]-1
    one_to_s+=1

loop_l=0
tmp=loop_s
Loop=[loop_s]
while(1):
    if tmp==loop_g:
        break
    tmp=A[tmp]-1
    Loop.append(tmp)
    loop_l+=1
loop_l+=1

if K<=one_to_s:
    tmp=0
    cnt=0
    while(1):
        if cnt==K:
            break
        tmp=A[tmp]-1
        cnt+=1
    ans=tmp + 1
else:
    K-=one_to_s
    num=K%loop_l
    ans=Loop[num]+1

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque

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

L=[]
chk=[0 for _ in range(N)]
tmp=0
while(1):
    if chk[tmp]==1:
        break
    chk[tmp]=1
    L.append(tmp)
    tmp=A[tmp]-1
#print(L)
loop_s=A[L[-1]]-1
loop_g=L[-1]
one_to_s=0
tmp=0
#print(loop_s)
#print(loop_g)

while(1):
    if tmp==loop_s:
        break
    tmp=A[tmp]-1
    #print(tmp)
    one_to_s+=1

loop_l=0
tmp=loop_s
Loop=[loop_s]
while(1):
    if tmp==loop_g:
        break
    tmp=A[tmp]-1
    Loop.append(tmp)
    loop_l+=1
loop_l+=1
#print(one_to_s)
if K<=one_to_s:
    tmp=0
    #print("ON")
    cnt=0
    while(1):
        if cnt==K:
            break
        tmp=A[tmp]-1
        cnt+=1
    ans=tmp + 1
else:
    K-=one_to_s
    num=K%loop_l
    ans=Loop[num]+1

print(ans)
### BUGGY CODE ###

n= int(input())
s = input()
a = [str(c) for c in s]




def search(a,n):
  x = 0
  y = n-1
  for i in range(n):
    x = i
    if a[i] == 'W':
      break
  for i in range(n):
    y = n-i-1
    if a[n-i-1] == 'R':
      break
  return[x, y]

c = 0

for i in range(n):
  z = search(a, n)
  if z[0] < z[1]:
    a[z[0]], a[z[1]] =a[z[1]], a[z[0]]
    c += 1
  else:
    break
    
print(c)

### FIXED CODE ###

n = int(input())
s = input()
a = [str(c) for c in s]

def sea(a, x, y, n):
  while x < n-1:
    if a[x] == 'W':
      break
    x += 1
    
  while y > 0:
    if a[y] == 'R':
      break
    y -= 1
  
  return[x, y]

z = [0, n-1]

z = sea(a, z[0] ,z[1], n)
c = 0
while z[0] < z[1]:
  a[z[0]], a[z[1]] = a[z[1]], a[z[0]]
  c += 1
  z = sea(a,z[0], z[1],n)
  
print(c)
### BUGGY CODE ###

N = int(input())
S = input()

cnt = 0
for i in range(N):
    for j in range(N):
        k = i*2 - j
        if j < k < N and S[i] != S[j] and S[j] !=S[k] and S[i] != S[k]:
            cnt += 1

print(S.count("R")*S.count("G")*S.count("B")-cnt)

### FIXED CODE ###

N = int(input())
S = input()

cnt = 0
for i in range(N):
    for j in range(N):
        k = i*2 - j
        if j < k < N and S[i] != S[j] and S[j] !=S[k] and S[i] != S[k]:
            cnt += 1

print(S.count("R")*S.count("G")*S.count("B")-cnt)
### BUGGY CODE ###

import math

mod = 10**9+7
N,M,K = map(int, input().split())
MAX = min(N*M,mod)

facts = [1 for i in range(MAX)]
invs = [1 for i in range(MAX)]

def inv(x):
	return pow(x,mod-2,mod)

for i in range(1,MAX):
    facts[i] = (facts[i-1] * i)% mod
    invs[i] = inv(facts[i])

def nCr(n,r):
	return facts[n] * invs[r] * invs[n-r] % mod

def main():
    ans = 0
    complement = nCr((N*M-2)%mod,(K-2)%mod)
    for i in range(N-1):
        for j in range(i+1,N):
            d = abs(i - j)
            ans += d * M**2
    for i in range(M-1):
        for j in range(i+1,M):
            d = abs(i - j)
            ans += d * N**2
    print((ans*complement) % mod)

main()


### FIXED CODE ###

import math

mod = 10**9+7
N,M,K = map(int, input().split())
MAX = min(N*M,mod)

facts = [1 for i in range(MAX)]
invs = [1 for i in range(MAX)]

def inv(x):
	return pow(x,mod-2,mod)

for i in range(1,MAX):
    facts[i] = (facts[i-1] * i)% mod
    invs[i] = inv(facts[i])

def nCr(n,r):
	return facts[n] * invs[r] * invs[n-r] % mod

def main():
    ans = 0
    complement = nCr((N*M-2)%mod,(K-2)%mod)
    for i in range(1,N):
        ans += i * (N-i) * M**2
    for i in range(1,M):
        ans += i * (M-i) * N**2
    print((ans*complement) % mod)

main()
### BUGGY CODE ###

import numpy as np
import bisect
INF = 10**15
def solve(a, b, q, s, t, x):
    for xi in x:
        sl = s[bisect.bisect_left(s, xi+1)-1]
        tl = t[bisect.bisect_left(t, xi+1)-1]
        sr = s[bisect.bisect_right(s, xi-1)]
        tr = t[bisect.bisect_right(t, xi-1)]
        ans = min([
            max(sr-xi, tr-xi),
            max(xi-sl, xi-tl),
            (sr-xi+sr-tl),
            (xi-tl+sr-tl),
            (tr-xi+tr-sl),
            (xi-sl+tr-sl)
        ])
        print(ans)

a, b, q = map(int, input().split())
s = np.asarray([int(input()) for i in range(a)] + [-INF, INF], dtype=int)
t = np.asarray([int(input()) for i in range(b)] + [-INF, INF], dtype=int)
x = np.asarray([int(input()) for i in range(q)], dtype=int)
s.sort()
t.sort()
solve(a,b,q,s,t,x)

### FIXED CODE ###

import numpy as np
import bisect
INF = 10**11
def solve(a, b, q, s, t, x):
    for xi in x:
        si = bisect.bisect_left(s, xi)
        ti = bisect.bisect_left(t, xi)
        sl = s[si-1]
        tl = t[ti-1]
        sr = s[si]
        tr = t[ti]
        ans = min([
            max(sr-xi, tr-xi),
            max(xi-sl, xi-tl),
            (sr-xi+sr-tl),
            (xi-tl+sr-tl),
            (tr-xi+tr-sl),
            (xi-sl+tr-sl)
        ])
        print(ans)

a, b, q = map(int, input().split())
s = np.asarray([int(input()) for i in range(a)] + [-INF, INF], dtype=int)
t = np.asarray([int(input()) for i in range(b)] + [-INF, INF], dtype=int)
x = np.asarray([int(input()) for i in range(q)], dtype=int)
s.sort()
t.sort()
solve(a,b,q,s,t,x)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import itertools

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


def resolve():
    n = int(input().rstrip())

    for m in range(1, n+1):
        xyz_list = []
        for i in range(1, m+1):
            xyz_list.append(i)
        p = itertools.combinations_with_replacement(xyz_list, 3)
        ans_cnt = 0
        for v in p:
            x, y, z = v
            max_value = max(x, y, z)
            if max_value*max_value >= m:
                continue

            ans = x*x + y*y + z*z + x*y + y*z + z*x

            if ans == m:
                if x == y == z:
                    ans_cnt += 1
                elif x == y or y == z or x == z:
                    ans_cnt += 3
                else:
                    ans_cnt += 6

        print(ans_cnt)



if __name__ == "__main__":
    resolve()



### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import itertools
import math

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


def resolve():
    n = int(input().rstrip())
    max_n = n
    max_n = math.sqrt(max_n)
    max_n = math.ceil(max_n)

    ans = [0] * 10050

    for i in range(1, max_n+1):
        for j in range(1, max_n+1):
            for k in range(1, max_n+1):
                v = i*i + j*j + k*k + i*j + j*k + k*i
                if v < 10050:
                    ans[v] += 1

    for i in range(n):
        print(ans[i+1])

    """
    p = itertools.combinations_with_replacement(range(1, max_n), 3)

    #print(len(list(p)))
    ans_list = []


    for v in p:

        x, y, z = v
        ans_cnt = 0
        ans_list.append(x * x + y * y + z * z + x * y + y * z + z * x)



        if ans == m:
            if x == y == z:
                ans_cnt += 1
            elif x == y or y == z or x == z:
                ans_cnt += 3
            else:
                ans_cnt += 6
    """


    """
    for m in range(1, n+1):

        max_n = math.sqrt(m)
        max_n = math.ceil(max_n)
        p = itertools.combinations_with_replacement(range(1,max_n), 3)

        ans_cnt = 0
        for v in p:
            #print(v)
            x, y, z = v
            ans = x*x + y*y + z*z + x*y + y*z + z*x

            if ans == m:
                if x == y == z:
                    ans_cnt += 1
                elif x == y or y == z or x == z:
                    ans_cnt += 3
                else:
                    ans_cnt += 6

        print(ans_cnt)
    """


if __name__ == "__main__":
    resolve()
### BUGGY CODE ###

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 CODE ###

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 CODE ###

# B
N = int(input())
ans = 1
for i in range(1, N+1):
    ans *= i
print(ans % (10 ** 9 + 7))

### FIXED CODE ###

# B
import math
N = int(input())
print(math.factorial(N) % (10 ** 9 + 7))