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

n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
	a_bkup=a
	ai=a[i]
	clear=True
	scale=0
	for j in range(n):
		if(j<=i):
			scale+=a[j]
		elif(2*scale>=a[j]):
			scale+=a[j]
		else:
#			print(i,j,scale)
			clear=False
			break
	
	if(clear):
		ans=n-i
		break

print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=n
sum_former=sum(a)
for i in range(n-1,-1,-1):
    sum_former-=a[i]
    if(2*sum_former < a[i]):
        ans=n-i
        break

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

import sys
input = sys.stdin.readline
from collections import deque
H,W,K = map(int,input().split())
sx,sy,gx,gy = map(int,input().split())
sx-=1;sy-=1;gx-=1;gy-=1
Pond = []; INF = float("inf")
for i in range(H):
  temp = str(input());temp = list(temp)
  Pond.append(temp)
#print(Pond)
Q = deque([])
Q.append((sx,sy))
reach = [[INF]*W for _ in range(H)]
reach[sx][sy] = 0
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
while Q:
  nx,ny = Q.popleft()
  step = K
  for i in range(4):
    for fac in range(1,K+1):
      tx = nx + fac*dxdy[i][0]
      ty = ny + fac*dxdy[i][1]
      #print(i,tx,ty)
      if 0>tx or tx>=H or 0>ty or ty>=W or Pond[tx][ty] == "@": #or reach[tx][ty] != INF:
        #print(i,tx,ty,reach[2][0])
        break #範囲外やハスがあった、到達済みの場合には終了
      #print(i,tx,ty)
      if reach[nx][ny] + 1 > reach[tx][ty]: #もし現時点よりもステップが大きい場合はだめ。
        #同じ場合は向き的に得している場合もあるので残す。
        break
      reach[tx][ty] = reach[nx][ny] + 1
      Q.append((tx,ty))
    if tx == gx and ty == gy:
      print(reach[gx][gy])
      exit()
#print(reach)
ans = reach[gx][gy]
if ans == INF:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

from collections import deque
H,W,K= map(int,input().split())
sx,sy,gx,gy = map(int,input().split())
sx-=1;sy-=1;gx-=1;gy-=1 #0index
Pond = []
for i in range(H):
  temp = str(input())
  temp = list(temp)
  Pond.append(temp)
#print(Pond)
INF = float("inf")
reach = [[INF for _ in range(W)] for _ in range(H)]
reach[sx][sy] = 0
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
Q = deque([(sx,sy)])
while Q:
  x,y = Q.popleft()
  #print(x,y)
  #step = reach[x][y]
  for j in range(4):
    for i in range(1,K+1):
      fac = i
      nx = x+fac*dxdy[j][0]
      ny = y+fac*dxdy[j][1]
      #print(nx,ny)
      if nx<0 or nx>=H or ny<0 or ny>= W or Pond[nx][ny] == "@":
        break
      if reach[x][y]+1 > reach[nx][ny]: #すでに余裕をもって到達済み
        break
      if reach[x][y]+1 < reach[nx][ny]:
        reach[nx][ny] = min(reach[x][y]+1,reach[nx][ny])
        Q.append((nx,ny))
      if nx == gx and ny == gy:
        #print(reach)
        print(reach[nx][ny])
        exit()
print(-1)
### BUGGY CODE ###

import bisect
N = int(input())
P = list(map(int, input().split()))
P_id = [0]*(N + 1)

for i in range(N):
    P_id[P[i]] = i

A = [- 1, P_id[N], N] 

res = 0
for i in range(N - 1, 0, - 1):
    j = bisect.bisect_left(A, P_id[i])
    A.insert(j, P_id[i])
    l1 = A[j - 1]
    r1 = A[j + 1]
    l2 = l1
    r2 = r1
    if l1 != - 1:
        l2 = A[j - 2]
    if r1 != N:
        r2 = A[j + 2]
    
    res += i*((A[j] - l1)*(r2 - r1) + (l1 - l2)*(r1 - A[j]))
print(res)

### FIXED CODE ###

import bisect
import array
N = int(input())
P = list(map(int, input().split()))
P_id = [0]*(N + 1)

for i in range(N):
    P_id[P[i]] = i

A = array.array('i', [- 1, P_id[N], N])


res = 0
for i in range(N - 1, 0, - 1):
    j = bisect.bisect_left(A, P_id[i])
    A.insert(j, P_id[i])
    l1 = A[j - 1]
    r1 = A[j + 1]
    l2 = l1
    r2 = r1
    if l1 != - 1:
        l2 = A[j - 2]
    if r1 != N:
        r2 = A[j + 2]
    
    res += i*((A[j] - l1)*(r2 - r1) + (l1 - l2)*(r1 - A[j]))

print(res)
### BUGGY CODE ###

import numpy as np
import itertools

N, A, B = list(map(int, input().split()))
V = np.array(list(map(int, input().split())))
V.sort()
V[:] = V[::-1]

def nCp(n, p):
    return(len(list(itertools.combinations(np.arange(n), p))))

d = V[A-1]
# unless all equal, we only need A
if d == V.max():
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    print(V[:A].mean())
    print(sum([nCp(d_eq_cnt, k) for k in range(A, min(B,d_eq_cnt)+1)]))
else:
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    d_lq_cnt = np.count_nonzero(V > d)
    print(V[:A].mean())
    print(nCp(d_eq_cnt, A - d_lq_cnt))



### FIXED CODE ###

import numpy as np

N, A, B = list(map(int, input().split()))
V = np.array(list(map(int, input().split())))
V.sort()
V[:] = V[::-1]

def fac(n):
    return 1 if n<=1 else n*fac(n-1)
        
def nCr(n, r):
    return fac(n) // fac(n-r) // fac(r)

d = V[A-1]
# unless all equal, we only need A
if d == V.max():
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    res = nCr(d_eq_cnt, A)
    res_sum = res
    for k in range(1, min(B, d_eq_cnt) + 1 - A):
        res = res * (d_eq_cnt - (A+k-1)) // (A+k)
        res_sum += res
    print(V[:A].mean())
    print(res_sum)
    
    
else:
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    d_lq_cnt = np.count_nonzero(V > d)
    print(V[:A].mean())
    print(nCr(d_eq_cnt, A - d_lq_cnt))
### BUGGY CODE ###

import math

n = int(input())
s = input()

R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B

for i in range(n):
    for j in range(n):
        c1 = i
        c2 = i + j
        c3 = i + j * 2
        if c3 >= n: continue
        if c1 == c2 == c3: continue
        if s[c1] != s[c2] and s[c2] != s[c3] and s[c1] != s[c3]:
            ans -= 1

print(ans)
# 012 024 036 048
# 123 135 147 159

### FIXED CODE ###

import math

n = int(input())
s = input()

R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B

for i in range(n):
    for j in range(n):
        c1 = i
        c2 = i + j
        c3 = i + j * 2
        if c3 >= n: continue
        if c1 == c2 == c3: continue
        if s[c1] != s[c2] and s[c2] != s[c3] and s[c1] != s[c3]:
            ans -= 1

print(ans)
# 012 024 036 048
# 123 135 147 159
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

cnt = 0

maxr = N // R + 1
maxg = N // G + 1
maxb = N // B + 1

for r in range(0, maxr+1):
  Rr = R*r
  if Rr > N: break
  for g in range(0, maxg+1):
    RrGg = Rr + G*g
    if RrGg > N: break
    for b in range(0, maxb+1):
      p = RrGg + B*b
      if p == N:
        cnt += 1
        break
      elif p > N: break
        
print(cnt)

### FIXED CODE ###

###template###
import sys
input = sys.stdin.readline
def mi(): return map(int, input().split())
###template###

Rt, Gt, Bt, N = mi()

R = max(Rt, Gt, Bt)
B = min(Rt, Gt, Bt)
G = Rt+Gt+Bt-R-B

cnt = 0
if G == 1 and B == 1:
  for i in range(N//R+1):
    cnt += (N-R*i)+1
  print(cnt)
  exit()

for i in range(N//R+1):
  for j in range((N-R*i)//G+1):
    #残り必要ボール数
    if (N - R*i - G*j)%B == 0:
      cnt += 1

print(cnt)
### BUGGY CODE ###

n = int(input())
s = input()
s_lis = []
for i in range(len(s)):
    if s[i] not in s_lis:
        s_lis.append(s[i])
s_lis_len = len(s_lis)
del_n = n - 3
ch_n = len(s) - del_n
import itertools
lis = []
cnt = 0
for i in itertools.combinations(s, ch_n):
    if cnt >= s_lis_len ** 3:
        break
    tmp_ch = ''.join(i)
    if tmp_ch not in lis:
        lis.append(tmp_ch)
        cnt += 1
print(len(lis))

### FIXED CODE ###

from string import digits

n = int(input())
s = input()

cnt = 0
for i in digits:
    x = s.find(i)
    if x == -1:
        continue
    for j in digits:
        y = s.find(j, x + 1)
        if y == -1:
            continue
        for k in digits:
            z = s.find(k, y + 1)
            if z == -1:
                continue
            cnt += 1

print(cnt)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
    n = int(input())
    ans = 0
    cnt = [[[0]*80 for j in range(80)] for i in range(20)]
    for _ in range(n):
        a = list(map(str, input().rstrip().split(".")))
        x = 0
        if len(a) == 1:
            x = int(a[0]) * 10**9
        else:
            x = int(a[0]) * 10**9 + int(a[1]) * pow(10, 9-len(a[1]))
        cnt_10, cnt_2, cnt_5 = 0, 0, 0
        while x % 10 == 0:
            cnt_10 += 1
            x //= 10
        while x % 2 == 0:
            cnt_2 += 1
            x //= 2
        while x % 5 == 0:
            cnt_5 += 1
            x //= 5
        for i in range(15):
            if i + cnt_10 >= 18:
                for j in range(50):
                    ans += sum(cnt[i][j])
            else:
                p = 18 - cnt_10 - i
                if cnt_2 >= p:
                    for j in range(p, 50):
                        ans += cnt[i][0][j]
                if cnt_5 >= p:
                    for j in range(p, 50):
                        ans += cnt[i][j][0]
        cnt[cnt_10][cnt_2][cnt_5] += 1
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
ans = 0
cnt = [[0]*20 for _ in range(45)]
for _ in range(n):
    a = list(map(str, input().rstrip().split(".")))
    x = 0
    if len(a) == 1:
        x = int(a[0]) * 10**9
    else:
        x = int(a[0]) * 10**9 + int(a[1]) * pow(10, 9-len(a[1]))
    cnt_2, cnt_5 = 0, 0
    while x % 2 == 0:
        cnt_2 += 1
        x //= 2
    while x % 5 == 0:
        cnt_5 += 1
        x //= 5
    for i in range(45):
        for j in range(20):
            if cnt_2 + i >= 18 and cnt_5 + j >= 18:
                ans += cnt[i][j]
    cnt[cnt_2][cnt_5] += 1
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Aug  2 21:11:34 2020

@author: NEC-PCuser
"""

N = int(input())

s = input()

l = 0
r = len(s) - 1
count = 0
while True:
	flg = False
	for i in range(l, r):
		if (s[i] == 'W'):
			l = i + 1
			flg = True
			break
	for j in range(r, l - 1, -1):
		if (s[j] == 'R'):
			r = j - 1
			if flg:
				count += 1
				str_list = list(s)
				str_list[l - 1] = 'R'
				str_list[r + 1] = 'W'
				s = "".join(str_list)
			break
	if flg == False:
		break
print(count)
	

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Aug  2 21:11:34 2020

@author: NEC-PCuser
"""

N = int(input())

s = input()

l = 0
r = len(s) - 1
count = 0
while True:
	flg = False
	for i in range(l, r):
		if (s[i] == 'W'):
			l = i + 1
			flg = True
			break
	for j in range(r, l - 1, -1):
		if (s[j] == 'R'):
			r = j - 1
			if flg:
				count += 1
			break
	else:
		break
	if flg == False:
		break
print(count)
### BUGGY CODE ###

x = int(input())
ls = []
for i in range(101):
    ls.append(pow(i, 5))

a = 0
while True:
    b = pow(a, 5)-x
    if -b in ls:
        print(a, -ls.index(-b))
        break
    if b in ls:
        print(a, ls.index(b))
        break
    a += 1


### FIXED CODE ###

x = int(input())

for a in range(200):
    for b in range(200):
        if pow(a, 5) - pow(b, 5) == x:
            print(a, b)
            exit()
        if pow(-a, 5) - pow(b, 5) == x:
            print(-a, b)
            exit()
        if pow(a, 5) - pow(-b, 5) == x:
            print(a, -b)
            exit()
        if pow(-a, 5) - pow(-b, 5) == x:
            print(-a, -b)
            exit()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import numpy as np

H,W,D = map(int,input().split())
N = H*W

# 各数値の書かれている位置, 1-indexed
X = np.zeros(N+1,dtype=np.int64)
Y = np.zeros(N+1,dtype=np.int64)

for x in range(H):
  row = input()
  for y,n in enumerate(row.split()):
    X[int(n)] = x
    Y[int(n)] = y

#n%Dからnへ移動するために必要な魔力
MAGIC = np.zeros(N+1,dtype=np.int64)

for d in range(1,D+1):
  DX = np.abs(np.diff(X[d::D]))
  DY = np.abs(np.diff(Y[d::D]))
  MAGIC[d+D::D] = (DX + DY).cumsum()


Q = int(input())
output = []
for _ in range(Q):
  l,r = map(int,input().split())
  output.append(MAGIC[r] - MAGIC[l])

print('\n'.join(map(str,output)))

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np

H,W,D = map(int,input().split())
N = H*W
ND = N//D

# 各数値の書かれている位置, 1-indexed
X = np.zeros((D,ND+1),dtype=np.int64)
Y = np.zeros((D,ND+1),dtype=np.int64)

for x in range(H):
  row = input()
  for y,n in enumerate(row.split()):
    n = int(n)
    q,r = n//D,n%D
    X[r,q] = x
    Y[r,q] = y

# 0D+d から nD+d への移動コスト
MAGIC = np.zeros_like(X)
MAGIC[:,1:] = (np.abs(np.diff(X,axis = 1)) + np.abs(np.diff(Y,axis = 1))).cumsum(axis = 1)

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

n = int(input())
a = list(map(int,input().split()))
ans =[]
sum_rain = sum(a)
a_double = [i*2 for i in a]*2
for i in range(n):
  minus = sum(a_double[i+1:i+n-1:2])
  ans.append(sum_rain-minus)
  
ans_str = [str(i) for i in ans]
print(' '.join(ans_str))
    
    

  
  


    

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans =[0]
sum_rain = sum(a)
a_double = [i*2 for i in a]*2
minus = sum(a_double[1:n-1:2])
ans[0] = sum_rain-minus

for i in range(1,n): 
  ans.append(2*a[i-1]-ans[i-1])

print(' '.join(map(str,ans)))
### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def solve(X: str):
    i = X.find("ST")
    while i >= 0:
        X = X[:i] + X[i+2:]
        i = X.find("ST")
    print(len(X))


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = next(tokens)  # type: str
    solve(X)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque


def solve(X: str):
    stack = deque(X[0])
    for i in range(1, len(X)):
        if not stack:
            stack.append(X[i])
            continue
        if stack[-1] == "T":
            stack.append(X[i])
            continue
        if X[i] == "T":
            stack.pop()
            continue
        stack.append(X[i])

    print(len(stack))


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = next(tokens)  # type: str
    solve(X)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

for m in range(M):
  A[-1]//=2
  A = sorted(A)
  
print(sum(A))

### FIXED CODE ###

from heapq import *
N,M = map(int,input().split())
A = list(map(lambda x:-int(x),input().split()))
heapify(A)

for m in range(M):
  heappush(A,int(heappop(A)/2))

print(-sum(A))
### BUGGY CODE ###

N = int(input())
A = tuple(map(lambda n: int(n) - 1, input().split()))

if not 0 in A:
    print(-1)
else:
    for j in range(N+1):
        # jは残す数
        try:
            nf = A.index(j)
            A = A[nf:]
        except ValueError:
            break

    print(N - j)

### FIXED CODE ###

N = int(input())
A = tuple(map(lambda n: int(n) - 1, input().split()))

rem = 0
bk = 0
for a in A:
    if a == rem:
        rem += 1
    else:
        bk += 1

if bk == N:
    print(-1)
else:
    print(bk)
### BUGGY CODE ###

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import accumulate
def main():
    s = input()
    n = len(s)

    amari = [0] * n
    ketaamari = 1
    for i1 in range(n):
        t = (ketaamari * int(s[-i1 -1])) % 2019
        amari[-i1-1] = t
        ketaamari = (ketaamari * 10) % 2019
    amaria = list(accumulate(amari))
    r = 0
    for j1 in range(n):
        r += sum([ae % 2019 == 0 for ae in amaria[j1:]])
        amaria = [ae - amaria[j1] for ae in amaria]
    print(r)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import Counter
def main():
    s = input()
    n = len(s)

    amari = [0] * n
    ketaamari = 1
    t = 0
    for i1 in range(n):
        t = (t + ketaamari * int(s[-i1 -1])) % 2019
        amari[-i1-1] = t
        ketaamari = (ketaamari * 10) % 2019
    amari.append(0)
    ac = Counter(amari)
    r = 0
    for v in ac.values():
        r += v * (v - 1) // 2
    print(r)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import numpy as np
import random

D=int(input())
C=np.array(list(map(int,input().split())))
last_day=np.array([-1 for _ in range(26)])
score=np.array([list(map(int,input().split())) for _ in range(D)])
output=[0 for _ in range(D)]

#初期貪欲法
for day in range(D):
    today_point=C*(day-last_day)
    S_today=sum(today_point)
    for k in range(26):
        today_point[k]=score[day][k]-S_today+today_point[k]
 
    if day!=D-1:
        max_score=-1*float("inf")
        for k in range(26):
            nday_point=C*((day+1)-last_day)
            S_nday=sum(nday_point)-C[k]*(day-last_day[k])
            
            for i in range(26):
                if k!=i:
                    nday_point[i]=score[day+1][i]-S_nday+nday_point[i]
                else:
                    nday_point[i]=score[day+1][i]-S_nday+C[i]
 
                if today_point[k]+nday_point[i]>max_score:
                    max_score=today_point[k]+nday_point[i]
                    idx=k
    else:
        idx=np.argmax(today_point)
    
    last_day[idx]=day
    output[day]=idx+1

def score_cal(output):
    ans=0
    memo=np.array([-1 for _ in range(26)])
    for day in range(D):
        t=output[day]-1
        memo[t]=day
        tmp=C*(memo-day)
        ans=ans+score[day][t]+sum(tmp)
    return ans

  
random_day=[i for i in range(D)]
random_con=[i+1 for i in range(26)]


for i in range(2000):
    tmp_output=output[:]
    d=random.choice(random_day)
    con=random.choice(random_con)
    tmp_output[d]=con
    
    if score_cal(tmp_output)>score_cal(output):
        output[d]=con

print(*output,sep="\n")

### FIXED CODE ###

import numpy as np
ans=0
D=int(input())
C=np.array(list(map(int,input().split())))
last_day=np.array([0 for _ in range(26)])

for day in range(1,D+1):
    score=np.array(list(map(int,input().split())))
    tmp=C*(last_day-day)
    #今回行うコンテストで得られる
    idx=np.argmax(tmp+score)
    # ans=ans+score[idx]+np.sum(tmp)+abs(tmp[idx])
    last_day[idx]=day
    print(idx+1)
### BUGGY CODE ###

n=int(input())
P=list(map(int,input().split()))
s=0
for i in range(n):
  x=P[i]
  flag=True
  for j in range(i):
    if P[j]<x:
      flag=False
      break
  if flag:
    s+=1
print(s)


### FIXED CODE ###

n=int(input())
lst=list(map(int,input().split()))
premin=lst[0]
ans=0
for x in lst:
  if premin>=x:
    ans+=1
    premin=x
print(ans)
### BUGGY CODE ###

N,X,Y = map(int, input().split())
n = list(range(1,N+1))
ans = {i: 0 for i in range(1,N)}
for i in range(1,N):
  for a,b in zip(n[:-i], n[i:]):
    c = min([abs(b-a), abs(X-a)+abs(Y-b)+1, abs(Y-a)+abs(X-b)+1])
    ans[c] += 1
print("\n".join([str(ans[i]) for i in range(1,N)]))

### FIXED CODE ###

from itertools import combinations
N,X,Y = map(int, input().split())
ans = [0]*(N-1)
for a,b in combinations(range(N),2):
  c = min([abs(a-b), abs(X-1-a)+abs(Y-1-b)+1, abs(Y-1-a)+abs(X-1-b)+1])
  ans[c-1] += 1
for i in ans: print(i)
### BUGGY CODE ###

import math
import sys
input = sys.stdin.readline
a,b,n = map(int,input().split())
li = []

for x in range(n+1):
    li.append(math.floor((a*(x))/b) - a * math.floor(x/b))
print(max(li))

### FIXED CODE ###

import math
 
A, B, N = map(int, input().split())
 
 
ans1 = 0
 
if N > B - 1:
    x = B-1
    print(int((A * x) / B) - A * int(x / B))
elif N <= B - 1:
    x = N
    print(int((A * x) / B) - A * int(x / B))
### BUGGY CODE ###

N, M = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort()



for i in range(M):
  A[N-1] = A[N-1] // 2
  if A[N-1] < A[N-2]:
    A.sort()
    
print(sum(A))

### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A = [int(i) * (-1) for i in input().split()]
heapq.heapify(A)
h = heapq.heappop(A)

for i in range(M):
  h = heapq.heappushpop(A, (h*(-1))//2*(-1))
    
print((sum(A)+h) * (-1))
### BUGGY CODE ###

import math
N=int(input())
ls=[int(s) for s in input().split()]
M=max(ls)
SQRT_M=int(math.sqrt(M))+1
#素数のリスト作成
prime=[1 for i in range(SQRT_M+1)]
prime[0]=0
prime[1]=0
primels=[]
primedic={}
for i in range(2,SQRT_M+1):
  if prime[i]==1:
    primels.append(i)
    primedic[i]=0
    a=1
    while a*i<=SQRT_M:
      prime[a*i]=0
      a+=1

for e in ls:
  for p in primels:
    if e%p==0:
      primedic[p]+=1
      while e%p==0:
        e//=p
    if e==1:
      break
  else:
    if e in primedic:
      primedic[e]+=1
    else:
      primedic[e]=1
    

A=max(primedic.values())

if A==len(ls):
  print('not coprime')
elif A>1:
  print('setwise coprime')
else:
  print('pairwise coprime')


      

### FIXED CODE ###

import math
import time

start=time.time()

N=int(input())
ls=[int(s) for s in input().split()]
M=max(ls)
SQRT_M=int(math.sqrt(M))+1
#素数のリスト作成
prime=[1 for i in range(SQRT_M+1)]
prime[0]=0
prime[1]=0
primels=[]
primedic={}
for i in range(2,SQRT_M+1):
  if prime[i]==1:
    primels.append(i)
    primedic[i]=0
    a=1
    while a*i<=SQRT_M:
      prime[a*i]=0
      a+=1

for e in ls:
  for p in primels:
    if e%p==0:
      primedic[p]+=1
      while e%p==0:
        e//=p
    if e==1:
      break
  else:
    if e in primedic:
      primedic[e]+=1
    else:
      primedic[e]=1
  if time.time()-start>1.9:
    break
    

A=max(primedic.values())

if A==len(ls):
  print('not coprime')
elif A>1:
  print('setwise coprime')
else:
  print('pairwise coprime')
### BUGGY CODE ###

n = int(input())
n_list = [int(i) for i in input().split()]
ans = 1
n_list.sort()
for i in n_list:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
print(ans)


### FIXED CODE ###

n = int(input())
n_list = [int(i) for i in input().split()]
ans = 1
n_list.sort()
n_list = list(reversed(n_list))
if 0 in n_list:
    print(0)
else:
    for i in n_list:
        ans *= i
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)
### BUGGY CODE ###


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

count = 0

for x in range(l[0] + 1):
    for y in range(l[0] + 1):
        for z in range(l[0] + 1):
            if x + y + z == l[1]:
                count += 1

print(count)


### FIXED CODE ###

k,s = map(int,input().split())
count = 0
for i in range(k+1):
  for m in range(k+1):
    if 0 <= s-i-m <= k:
      count += 1
print(count)
### BUGGY CODE ###

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

ans = 1
for item in a:
  ans = ans * item
  if ans > 1000000000000000000:
    ans = -1

print(ans)


### FIXED CODE ###

def main():
  N = int(input())
  A = list(map(int, input().split()))
  
  if 0 in A:
    print(0)
    return
  
  prod = 1
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  print(prod)
  
main()
### BUGGY CODE ###

def get_expect(p):
    return 1.0 * (p + 1) / 2

def main():
    N, K = map(int, input().split(" "))
    P = map(int, input().split(" "))

    e = list(map(get_expect, P))

    print(max([
        sum(
            e[i:i + K]
        )
        for i in range(N - K + 1)
    ]))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

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

N = input()
L = list(map(int,input().split()))
L.sort()
J = []
for i in range(len(L)):
  J.append(L.count(L[i]-1)+L.count(L[i])+L.count(L[i]+1))
print(max(J))

### FIXED CODE ###

N = int(input())
L = list(map(int,input().split()))
L.sort()
L.append(1000000)
M = [0]*((10**5)+1)
c = 0
d = 1
num = L[0]
if N == 1:
  print(1)
elif N == 2:
  if abs(L[0]-L[1]) <=1 :
    print(2)
  else:
    print(1)
else:
  while c <= N-1:
    if L[c] == L[c+1]:
      d += 1
      c += 1
    else:
      M[num] = d
      d = 1
      c += 1
      num = L[c]
  M.insert(0,0)
  M.append(0)
  ans = 0
  for i in range(len(M)-2):
    if M[i]+M[i+1]+M[i+2] >= ans:
      ans = M[i]+M[i+1]+M[i+2]
  print(ans)