peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
a=[0 for i in range(n)]
for i in range(n-1):
    c,s,f=map(int,input().split())
    for j in range(i+1):
        a[j]=-max(a[j],s)//f*-f+c
print(*a,sep='\n')
# Judge status: Accepted
N, M = tuple(map(int, input().split()))

import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if M < 2 and N < 2:
    print(0)
elif M < 2:
    print(comb(N,2))
elif N < 2:
    print(comb(M,2))
else:
    print(comb(N,2) + comb(M, 2))
# Judge status: Accepted
import math

a, b = input().split()

x = math.sqrt(int(a + b))

ret = 'No'
if math.ceil(x) == math.floor(x):
    ret = 'Yes'
print(ret)
# Judge status: Wrong Answer
N=int(input())
a=sorted(map(int,input().split()))
print(sum(a[N:2*N]))
# Judge status: Accepted
N = int(input())
if N % 2 == 1:
    print(0)
else:
    N_copy = N
    N_copy //= 2
    count_5 = 0
    count_2 = 0
    while N_copy > 0:
        N_copy //= 5
        count_5 += N_copy
    while N > 0:
        N //= 2
        count_2 += N
    print(min(count_2, count_5))
# Judge status: Accepted
D, T, S = map(int, input().split())
if T >= D / S:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
from math import floor
from decimal import Decimal


def main():
    a, b = map(Decimal, input().split())
    print(floor(a * b))


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b = map(int,input().split())
if b % 2 == 1:
    print("No")
else:
    if a*2 <= b and b<= a*4:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
N, M = map(int, input().split())

if N == M == 1:
    print(1)
    exit()

if N == 1 or M == 1:
    print(max(0, N * M - 2))
else:
    print(N * M - 2 * (N + M - 2))
# Judge status: Accepted
n, m, k = map(int, input().split())
flg = False
for i in range(n+1):
  for j in range(m+1):
    total = (n-i)*j + i*(m-j)
    if total == k:
      flg = True
      break
if flg:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n = int(input())
s = input()
w = [0]*(n + 2)
e = [0]*(n + 2)
ans = 10000

for i in range(1, n + 1):
    w[i] += w[i - 1]
    e[-i - 1] += e[-i]
    if s[i - 1] == "W":
        w[i] += 1
    if s[-i] == "E":
        e[-i - 1] += 1

for i in range(1, n + 1):
    ref = e[i + 1]
    ref += w[i - 1]
    ans = min(ans, ref)

print(ans)
# Judge status: Accepted
N = int(input())
s = input()
t = input()
sr = s[::-1]
for i in range(N+1):
    if s[i:] == t[:N-i]:
        break
print(N+i)
# Judge status: Accepted
N = int(input())
a = input().split()
ans = 0

from collections import Counter
d = Counter(a)

for i in d:
    if d[i] != int(i):
        if d[i] > int(i):
            ans += d[i] - int(i)
        else:
            ans += d[i]

print(ans)
# Judge status: Accepted
N = int(input())
print((N // 2) * (( N + 1 ) // 2))
# Judge status: Accepted
key = input()
s = []
for i in key:
  if i == '0' or i == '1':
    s.append(i)
  else:
    if len(s) > 0:
      s.pop(-1)
print(''.join(s))
# Judge status: Wrong Answer
sx,sy,tx,ty=map(int,input().split())
print("R"*(tx-sx)+"U"*(ty-sy)+"L"*(tx-sx)+"D"*(ty-sy)+"D"+"R"*(tx-sx+1)+"U"*(ty-sy+1)+"L"+"U"+"L"*(tx-sx+1)+"D"*(ty-sx+1)+"R")
# Judge status: Wrong Answer
import math
n=int(input())
s=0

r=0
t=n//2
for i in range(1,t+1):
    p=((n-1)//i)



    s+=p

print(s+t-1)
# Judge status: Wrong Answer
import random
x,y=map(int,input().split())
if (x*random.randint(1,9))%y != 0:
    print(x*random.randint(1,9))
# Judge status: Accepted
X = int(input())

for b in range(-1000, 1000, 1):
    for a in range(b, 1000, 1):
        if a ** 5 - b ** 5 == X:
            print(a, b)
            exit()
# Judge status: Accepted
K,N = map(int,input().split())
A=list(map(int,input().split()))
gap=A[0]-A[N-1]+K

for i in range(N-1):
    gap=max(gap,A[i+1]-A[i])
print(K-gap)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
c=[input().split() for i in range(a)]
d=0
for i in range(a):
  if abs(int(c[i][0])*int(c[i][1]))<=b**2:
    d=d+1
print(d)
# Judge status: Wrong Answer
s = input()
A = 0
Z = 0
for i in range (len(s)):
  if s[i] == "A":
    A = i
  if s[i] == "Z":
    Z = i

print(Z-A+1)
# Judge status: Accepted
N = int(input())
A = tuple(map(int, input().split()))
B = [a-(i+1) for i, a in enumerate(A)]
B = sorted(B)
b = B[len(B) // 2]
s = 0
for b_ in B:
    s += abs(b_ - b)
print(s)
# Judge status: Accepted
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]

lr = []
for i in range(n):
    l = max(xl[i][0] - xl[i][1], 0)
    r = max(xl[i][0] + xl[i][1], 0)
    lr.append([l, r])

lr.sort(key=lambda x: x[1])
keep = [False] * n


cur = 0
for i in range(n):
    if cur <= lr[i][0]:
        keep[i] = True
        cur = lr[i][1]

ans = sum(keep)
print(ans)
# Judge status: Accepted
x = input()
k=x.split(" ")
N = int(k[0])
T = int(k[1])


c = []
t = []

for i in range(N):
    p = input()
    y = p.split(" ")
    if int(y[1]) <= T:
        c.append(int(y[0]))
        t.append(int(y[1]))

if len(c) <=0:
    print("TLE")
else:
    print(min(c))
# Judge status: Wrong Answer
import sys
input = sys.stdin.buffer.readline
import fractions
from functools import reduce

def main():
    N = int(input())
    a = list(map(int,input().split()))
    MOD = 10**9+7
            
    def lcm(x,y):
        return((x*y)//fractions.gcd(x,y))
        
    l = reduce(lcm,a)
    ans = 0
    for num in a:
        ans += l//num
    
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
A,B,C=map(int,input().split())
if A+B >= C:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = input( )
result = sum(list(map(int, str(n))))

if result % 9 == 0 :
    print('Yes')
else :
    print('No')
# Judge status: Accepted
# -*- coding: utf-8 -*-

rgb = int(input().replace(" ", ""))

if rgb % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
N=int(input())
li = []

for n in range(2):
  li.append(list(map(int,input().split())))

max = 0

for x in range(N):
  now = 0
  for y in range(x):
    now += li[0][y]

  for y in range(N - x):
    now += li[0][y]
    
  now += li[1][N-1]

  if max < now:
    max = now

print(max)
# Judge status: Accepted
from collections import deque
K=int(input())
lun=deque([1,2,3,4,5,6,7,8,9])
for i in range(K):
    x=lun.popleft()
    if x%10!=0:
        lun.append(10*x+x%10-1)
    lun.append(10*x+x%10)
    if x%10!=9:
        lun.append(10*x+x%10+1)
print(x)
# Judge status: Wrong Answer
x = int(input())
num = [i**2 for i in range(1,33)]
def binary_search(li,k):
    left = 0
    right = 33
    while left < right:
        mid = (left+right)//2
        if li[mid]<=x and x<li[mid+1]:
            return li[mid]
        elif li[mid] < x:
            left = mid+1
        else:
            right = mid
print(binary_search(num,x))
# Judge status: Accepted
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (i*500 + j*100 + k*50) == X:
                ans += 1
print(ans)
# Judge status: Accepted
N=int(input())
A=[]
for i in range(1,(N//2)+1):
    A.append(list(str(i))+list(str(N-i)))
for i in range(len(A)):
    for j in range(len(A[i])):
        A[i][j]=int(A[i][j])
B=[]
for i in range(len(A)):
    B.append(sum(A[i]))
print(min(B))
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
if a>k:
  print(a-k,b)
elif a-k<0 and b-k+a>0:
  print('0',b-k+a)
elif a-k<0 and b-k+a<0:
  print('0','0')
# Judge status: Accepted
y = int(input())
if y == 3 or y == 5 or y == 7:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
A, B, C = map(int,input().split())

print('Yes' if A<C<B or B<C<A else 'No')
# Judge status: Accepted
n = int(input())
x = int(n / 1.08 - 2)
for i in range(x, x + 4):
    if int(i * 108 // 100) == n:
        print(i)
        break
else:
    print(":(")
# Judge status: Accepted
n = int(input())

print("ABC" if n<=999 else "ABD")
# Judge status: Accepted
import heapq

N, M = list(map(int,input().split()))
A = []
for i in range(N):
    in1, in2 = list(map(int,input().split()))
    A.append([in1, in2])

A = sorted(A)
ans = 0
day = 1
cnt = 0
x = []

for i in range(M):
    while(cnt < N):
        if A[cnt][0] == day:
            heapq.heappush(x, -A[cnt][1])
            cnt += 1
        else:
            break
    if x:  ans -= heapq.heappop(x)
    day += 1

print(ans)
# Judge status: Accepted
from collections import defaultdict
N=int(input())
alist=list(map(int,input().split()))

adic=defaultdict(int)
for a in alist:
  adic[a]+=1
alist2=list(adic.items())
alist2.sort(reverse=True)
#print(alist2)

x1,x2=0,0
for a2 in alist2:
  if a2[1]>=4:
    x1=max(x1,a2[0])
    x2=max(x2,a2[0])
  elif a2[1]>=2:
    if x1==0:
      x1=a2[0]
    else:
      x2=a2[0]

  if x1*x2>0:
    print(x1*x2)
    break
else:
  print(0)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    W = list(map(int, input().split()))
    s1 = W[0]
    s2 = sum(W) - s1

    ans = abs(s2 - s1)
    for t in range(1, N):
        s1 += W[t]
        s2 -= W[t]
        ans = min(ans, abs(s1 - s2))
    print(ans)



if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s = input()

tmp = s[0]
ans = 1
i = 1
while i < len(s):
    if tmp != s[i]:
        ans += 1
        tmp = s[i]
        i += 1
    elif i+2 < len(s):
        ans += 1
        tmp = s[i:i+2]
        i += 2
    else:
        break
print(ans)
# Judge status: Accepted
l=input()
x='abcdefghijklmnopqrstuvwxyz'
for k in range(len(x)):
  if x[k]==l:
    print(x[k+1])
# Judge status: Wrong Answer
n, m = map(int, input().split())
P, S = [], []
for _ in range(m):
    p, s = input().split()
    P.append(int(p))
    S.append(s)
ac = {}
wa = {}

for p, s in zip(P, S):
    if s == 'AC':
        ac.setdefault(p, 1)
    else:
        wa.setdefault(p, 0)
        if wa[p] == 0:
            wa[p] += 1
        
n_ac = 0
n_wa = 0

for i in ac.values():
    n_ac += i

for i in wa.values():
    n_wa += i

print(n_ac,n_wa)
# Judge status: Accepted
import math
x = int(input())

cnt = 0
while x > 0:
    cnt += 1
    x -= cnt
print(cnt)
# Judge status: Accepted
import numpy as np

N,k=map(int,input().split())
h = np.array(list(map(int,input().split())))

dp = np.zeros(N, dtype=int)

for i in range(1,N):
    start = max(i-k,0)
    dp[i] = np.min(dp[start:i] + np.abs(h[i] - h[start:i]))
    
print(dp[-1])
# Judge status: Accepted
n,m=map(int,input().split())
lis=[]
for i in range(n):
  lis.append(list(map(int,input().split())))
lis.sort()
counter=0
count=0
money=0
while count<m:
  kazu=min(m-count,lis[counter][1])
  money+=kazu*lis[counter][0]
  count+=kazu
  counter+=1
print(money)
# Judge status: Accepted
a,b=map(int,input().split())
i=list(range(2,14))
i.append(1)
ai,bi=i.index(a),i.index(b)
print("Draw" if ai==bi else "Alice" if ai>bi else "Bob")
# Judge status: Accepted
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
j=n
for i in range(n):
    if a[i]>=0:
        j=i
        break
a=list(map(abs,a))
a.sort()
if j%2==0:
    print(sum(a))
else:
    print(sum(a)-2*a[0])
# Judge status: Wrong Answer
sum(sorted(list(map(int, input().split())))[:2])
# Judge status: Wrong Answer
c=input()
if c==("a" or "i" or "u" or "e" or "o"):
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
a, b, c, d = map(int, input().split())
if abs(c-a) <= d:
  print('Yes')
elif abs(a-b) <= d and abs(c-b) <= d:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N = int(input())


ans = 0
stock = 0
for i in range(N):
  a,b = map(int, input().split())
  if a == b:
    ans += 1

print('Yes' if (ans > 2) else "No")
# Judge status: Accepted
import math

N, K = (int(a) for a in input().split())
A = [int(a) for a in input().split()]

def isOK(X):
    cutcount = 0
    for i in range(N):
        cutcount += math.ceil(A[i] / X) - 1
    if cutcount <= K:
        return True
    else:
        return False

def binary_search():
    left = 0
    right = max(A) + 1

    while (right - left) > 1:
        mid = left + (right - left) // 2
        if (isOK(mid)):
           right = mid;
        else:
            left = mid;

    return right

print(binary_search())
# Judge status: Wrong Answer
N,K = map(int, input().split())
S = 0
for _ in range(N):
    a,b = map(int, input().split())
    S += b
    if S >= K :
        print(a)
        break
# Judge status: Wrong Answer
S = input()[::-1]
string = list(map(
    lambda x: x[::-1],
    [
        "dream",
        "dreamer",
        "erase",
        "eraser"

    ]))
index = 0
while 1:
    for x in string:
        match = S.find(x, index)
        if match == -1:
            continue
        elif match > -1:
            index += match + len(x)
        if index == len(S):
            print("YES")
            exit()
# Judge status: Accepted
from math import ceil, floor

n = int(input())
ls = list(map(int, input().split()))
sqsm = 0
for i in range(n):
    sqsm += ls[i] * ls[i]
sm = sum(ls)
x1 = floor(sm / n)
x2 = ceil(sm / n)
print(min(sqsm + n * x1 * x1 - 2 * sm * x1, sqsm + n * x2 * x2 - 2 * sm * x2))
# Judge status: Accepted
a, b, k = map(int, input().split())

n_takahashi = a
n_aoki = b

cookies_to_eat = k
if n_takahashi > cookies_to_eat:
    n_takahashi = n_takahashi - cookies_to_eat
    cookies_to_eat = 0
else:
    cookies_to_eat = cookies_to_eat - n_takahashi
    n_takahashi = 0

if n_aoki > cookies_to_eat:
    n_aoki = n_aoki - cookies_to_eat
    cookies_to_eat = 0
else:
    cookies_to_eat = cookies_to_eat - n_aoki
    n_aoki = 0

print('{} {}'.format(n_takahashi, n_aoki))
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))

S=[0]*n
for i in range(len(A)):
    S[A[i]-1] = i+1

for s in S:
    print(s,end=" ")
# Judge status: Wrong Answer
a,b=map(int,input().split())
n=(a+b*(1/10))
print(n)
# Judge status: Wrong Answer
input()
bs = input()
b_list = [int(n) for n in bs.strip().split()]

print(sum(b_list) + b_list[0])
# Judge status: Accepted
w = input()
if w[-1] != 's':
    w += 's'
else:
    w += 'es'
print(w)
# Judge status: Wrong Answer
H = int(input())
W = int(input())
N = int(input())

ans = 0
num_bk = 0
for i in range(0,min(H,W)):
  num_bk += max(H,W)
  ans +=1
  if num_bk>N:
    print(ans)
    break
# Judge status: Accepted
from collections import defaultdict

N, M = map(int, input().split())
d = defaultdict(int)
for _ in range(N):
    for a in list(map(int, input().split()))[1:]:
        d[a] += 1

ans = 0
for _, v in d.items():
    if v == N:
        ans += 1

print(ans)
# Judge status: Wrong Answer
a = [int(input()) for _ in range(5)]
k = int(input())
for i in range(4):
  if a[i+1] - a[i] > k:
    print(":(")
    exit()
print("Yay!")
# Judge status: Accepted
if input().count('7')>0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a,b,c,k=map(int,input().split())

if k<=a:
    print(k)
elif k<=b:
    print(a)
else:
    print(2*a-k+b)
# Judge status: Accepted
N = int(input())

x = N * 800
y = (N // 15) * 200
print(x-y)
# Judge status: Accepted
import math
n = int(input())

ans = math.ceil(n/1.08)
if math.floor(ans*1.08) == n:
    print(ans)
else:
    print(":(")
# Judge status: Accepted
s=input()
ans=0
count=0
t=""
if s[0]=="A":
  ans+=1
for i in range(2,len(s)-1):
  # print(s[i])
  if s[i]=="C":
    count+=1
    t=s[1:i]+s[i+1:]	
# print(t)
if t.islower()==True and ans==1 and count==1:
  print("AC")
else:
  print("WA")
# Judge status: Wrong Answer
N = int(input())
cnt = 0
for a in range(1,N+1):
  cnt = cnt + int(N/a-0.00000000001)
print(cnt)
# Judge status: Accepted
A, B = map(int, input().split())
if A >= 13:
  print(B)
elif A >= 6:
  print(int(B/2))
else:
  print(0)
# Judge status: Wrong Answer
##かっこいい実装
import numpy as np
#mod = 10**9+7
#n = int(input())
#a = np.fromstring(input(), dtype = np.int64, sep = ' ')
#
#result = 0
#for i in range(60):
#    count_one = int((a&1).sum())
#    result += count_one*(n-count_one)*(2**i)
#    a >>= 1
#print(result%mod)

N = int(input())
A = np.fromstring(input(),dtype = np.int64, sep = ' ')
Large = 10**9 + 7
ans = 0
for i in range(60):
    sum1 = np.sum(A&1)
    ans += sum1*(N-sum1) * pow(2,i,Large)
    A>>=1 # A = A>>1とする
print(ans)
# Judge status: Accepted
from collections import Counter
def main():
    n = int(input())
    a = tuple(map(int, input().split()))
    ac = Counter(a)
    r = 0
    for ace in ac:
        if ac[ace] < ace:
            r += ac[ace]
        else:
            r += (ac[ace] - ace)
    print(r)

if __name__ == '__main__':
    main()
# Judge status: Accepted
from decimal import Decimal as d,ROUND_FLOOR as r

a,b=map(d,input().split())

print((a*b).quantize(d('0'),rounding=r))
# Judge status: Wrong Answer
N = int(input())
if N == 3 or 5 or 7:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
k, s = map(int, input().split())

ans = 0
for x in range(k + 1):
    for y in range(k + 1):
        if 0 <= s - x - y <= k:
            ans += 1
print(ans)
# Judge status: Accepted
card = {}
card['a'] = list(input())
card['b'] = list(input())
card['c'] = list(input())

p = 'a'

while True:
    p = card[p].pop(0)
    
    if len(card[p]) == 0:
        break

print(p.upper())
# Judge status: Wrong Answer
x = set(input().split())
print('No' if len(x)==1 else 'Yes')
# Judge status: Accepted
s = input()
ans = 0
cnt = 0
tmp = 0
pre = '>'
last = '>' if s[-1]=='<' else '<'
for now in s+last:
    if pre==now:
        cnt += 1
    else:
        if now=='<':
            ans += max(cnt, tmp)
            tmp = 0
        else:
            tmp = cnt
        ans += cnt*(cnt-1)//2
        cnt = 1
    pre = now
ans += tmp
print(ans)
# Judge status: Accepted
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]

A = [i[0] for i in AB]
B = [i[1] for i in AB]
from statistics import median

a_med = median(A)
b_med = median(B)

if N%2==1:
  print(b_med - a_med + 1)
  
else:
  print(int((b_med - a_med) * 2) + 1)
# Judge status: Accepted
n, m = map(int, input().split())
foods = [0] * (m + 1)
for i in range(n):
    k, *a = map(int, input().split())
    for j in a:
        foods[j] += 1

print(foods.count(n))
# Judge status: Accepted
N,M = map(int,input().split())
point = []
target = []
ans = []
for i in range(N):
    person = list(map(int,input().split()))
    point.append(person)
for j in range(M):
    goal = list(map(int,input().split()))
    target.append(goal)
for k in point:
    check = []
    for l in target:
        a = 0
        a += abs(k[0]-l[0])+abs(k[1]-l[1])
        check.append(a)
    b = min(check)
    ans.append(check.index(b))
for m in ans:
    print(m+1)
# Judge status: Accepted
K=int(input())
s=0

import math
# 全部同じパターン
for i in range(1, K+1):
  # print("{} {} {}".format(i,i,i))
  s += i

# 2つ同じパターン
for i in range(1, K+1):
  for j in range(1,K+1):
    if i==j:
      continue
    # print("{} {} {}".format(i,i,j))
    s += math.gcd(i,j)*3

from itertools import combinations
# 全部違うパターン
for i in combinations(range(1,K+1), 3):
  # print("{} {} {}".format(i[0], i[1], i[2]))
  s += math.gcd(math.gcd(i[0], i[1]),i[2])*3*2

print(s)
# Judge status: Wrong Answer
n,s=open(0);n,k=map(int,n.split());print(n-max(sum(i==j for i,j in zip(s,s[1:]))-2*k,1))
# Judge status: Accepted
def main():
    a, b = map(int, input().split())
    if a <= 0 <= b:
        print('Zero')
    elif b < 0:
        print('Positive' if (b - a + 1) % 2 == 0 else 'Negative')
    else:
        print('Positive')


if __name__ == '__main__':
    main()
# Judge status: Accepted
def resolve():
    S = list(input())
    mindiff = float("inf")
    for i in range(len(S)-2):
        val = int(S[i]+S[i+1]+S[i+2])
        mindiff = min(mindiff, abs(753-val))
    print(mindiff)

if '__main__' == __name__:
    resolve()
# Judge status: Accepted
n=(int)(input())
l=[]
for i in range(n):
   ar=input()
   l.append(ar)
print(len(set(l)))
# Judge status: Accepted
import math
A, B, C = map(int, input().split(' '))

if C - A - B >= 0 and 4 * A*B < (C - A - B) ** 2:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
for i in range(N):
    if a[i]%4==0:
        a[i]=2
    elif a[i]%2==0:
        a[i]=1
    else:
        a[i]=0
zero=a.count(0)
one=a.count(1)
two=a.count(2)

if zero>two+1:
    print("No")
elif zero==two+1:
    if zero+two==N:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")
# Judge status: Accepted
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n = int(input())
    sushi = ["a"]
    alt = [chr(ord("a") + i) for i in range(n)]
    for i in range(n-1):
        sushi = [ans + x for ans in sushi for x in alt[:len(set(ans)) + 1]]
    for i in sushi:
        print(i)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
n = int(input())
a = sorted(list(map(int,input().split())))
def runlength(S):
    ans = []
    for s in S:
        if len(ans) == 0 or ans[-1][0] != s:
            ans.append([s,1])
        else:
            ans[-1][1] += 1
    return ans
a = runlength(a)
ans = 0
for i in range(len(a)):
  if a[i][0] < a[i][1]:
    ans += a[i][1]-a[i][0]
  elif a[i][0] > a[i][1]:
    ans += a[i][1]
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
A = tuple(map(int, input().split()))
d = dict()
for a in A:
    d.setdefault(a, 0)
    d[a] += 1

cs = sorted(list(d.values()))

if len(cs) <= k:
    print(0)
else:
    c = 0
    print(sum(cs[:-k]))
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))

cnt = 0

for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] != L[j] and L[j] != L[k] and L[k] != L[i] and L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] > L[i]:
                cnt += 1

print(cnt)
# Judge status: Accepted
import sys
x=input()
y=input()
x0=x.split()
a=int(x0[0])
v=int(x0[1])
y0=y.split()
b=int(y0[0])
w=int(y0[1])
t=int(input())
l=abs(a-b)
r=v-w
if r<=0:
    print("NO")
    sys.exit()
if l/r<=t:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
S=int(input())
DP=[0 for i in range(S+1)]
DP[0]=1
for i in range(S+1):
    for j in range(3,S+1):
        if i+j<=S:
            DP[i+j]+=DP[i]
            DP[i+j]%=(10**9+7)
print(DP[-1])
# Judge status: Accepted
n = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n[0])]
ans = []
for i in x:
  if n[1] >= i[1]:
    ans.append(i[0])
if ans == []:
  print('TLE')
else:
  print(sorted(ans)[0])
# Judge status: Accepted
K = int(input())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(gcd(i, j), k)

print(ans)
# Judge status: Accepted
x, y, z = map(int, input().split())
ans = (x-z)//(y+z)
print(ans)
# Judge status: Wrong Answer
n=str(input())
a=n[-1]
print(a)
if a=='2' or n=='4' or a=='5' or a=='7' or a=='9':
    print('hon')
elif a=='3':
    print('bon')
else:
    print('pon')
# Judge status: Wrong Answer
(n, m) = map(int, raw_input().split())

res = 0

res += ((n + 1) / 2) * ((m + 1) / 2)
res += (n / 2) * (m / 2)
print res
# Judge status: Wrong Answer
N = int(input())
tmp_n = N
ans = []
while True:
    s, r = divmod(tmp_n, 26)
    if r == 0:
        r = 26
    ans.append(chr(r+96))
    tmp_n = s
    if s == 0:
        break
print("".join(ans[::-1]))
# Judge status: Accepted
a=list(map(int,input().split()))
if a.count(7)==1 and a.count(5)==2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
x=int(input())
ans=0

ans+=(x//500)*1000
x=x-((x//500)*500)

ans+=(x//5)*5

print(ans)
# Judge status: Wrong Answer
K = int(input())
n = 1000000

if K % 2 == 0:
    print(-1)
else:
    amari = 70
    for i in range(n):
        if amari % int(9 * K) == 7:
            print(i + 1)
            break
        else:
            amari = amari * 10
# Judge status: Accepted
a,b = map(int,input().split())
c = max(a,b)
d = min(a,b)
for i in range(1,a*b):
  e = c%d
  if e != 0:
    c = d
    d = e
  else:
    break
print(a*b//d)
# Judge status: Wrong Answer
k, n = list(map(int, input().split()))
an = list(map(int, input().split()))
bn = []
for i in range(n-1):
  bn.append(an[i+1]-an[i])
bn.append(k-an[n-1])
print(sum(bn)-max(bn))