peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
N_len = len(str(N))
ans = 0

if N_len % 2 != 0:
    ans += N - 10**(N_len-1)+1

for i in range(N_len):
    if (i % 2) != 0:
        ans += 10**i - 10**(i-1)

print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()

lst = []
for i in range(1,n+1):
    print(s[n-i:],t[:i])
    if s[n-i:] == t[:i]:
       lst.append(i+(n-i)*2)


if lst:
    print(min(lst))
else:
    print(n*2)
# Judge status: Accepted
a, b = map(int, input().split())
x = str(a) * b 
y = str(b) * a
z = sorted([x, y])
print(z[0])
# Judge status: Wrong Answer
n = int(input())
l = [input() for _ in [0]*n]

if len(set(l)) != n:
    print('No')
else:
    for i in range(n-1):
        #print(i)
        #print(list(l[i])[-1])
        #print(list(l[i+1])[0])
        if list(l[i])[-1] != list(l[i+1][0]):
            print('No')
            break
        else:
            continue
    else:
        print('Yes')
# Judge status: Accepted
N, K = map(int,input().split())
c = 0
N -= K
while True:
    if N <= 0:
        break
    N -= (K-1)
    c += 1
print(c+1)
# Judge status: Wrong Answer
s=list(input())
for i in range(0,len(s)//2):
    s=s[:-2]
    sa=s[:len(s)//2]
    sb=s[len(s)//2:]
    if sa==sb:
        print(len(s))
# Judge status: Wrong Answer
n, m = [int(i) for i in input().split()]
a, b = [], []
c = 0
for i in range(m):
    ship1, ship2 = [int(i) for i in input().split()]
    if ship1 == 1:
        c = max(c, ship2)
    a.append(ship1)
    b.append(ship2)

d = 0
for i in range(m):
    ship1, ship2 = a[i], b[i]
    if ship1 == c and ship2 == n:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")
# Judge status: Wrong Answer
import copy
n,m=map(int,input().split())
h=[0]+list(map(int,input().split()))
hh=copy.copy(h)
for i in range(m):
  a,b=map(int,input().split())
  if h[a]>h[b]:
    h[b]=h[a]
  elif h[a]<h[b]:
    h[a]=h[b]
cnt=0
for j in range(1,n+1):
  if h[j]==hh[j]:
    cnt+=1
print(cnt)
# Judge status: Wrong Answer
K = int(input())

count = 0
times=1
n = 0

while True:
    n += 7*times
    if n % K ==0:
        count +=1
        break
    times *=10
    count +=1
print(count)
# Judge status: Accepted
N = int(input())
S = input()
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N):
    for j in range(i + 1, N):
        k = j - i + j
        if k < N:
            if {S[i], S[j], S[k]} == {"R", "G", "B"}:
                ans -= 1
print(ans)
# Judge status: Accepted
# 尺取法ver

n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

asum, bsum = [0], [0]
for i in range(n):
  if k < a[i] + asum[i]:
    break
  asum.append(a[i] + asum[i])
for i in range(m):
  if k < b[i] + bsum[i]:
    break
  bsum.append(b[i] + bsum[i])

ans = 0
b_count = len(bsum)-1
for a_count in range(len(asum)):
  while asum[a_count] + bsum[b_count] > k:
    b_count -= 1
  ans = max(ans, a_count + b_count)
print(ans)
# Judge status: Accepted
S = input()
N = len(S)

ans = 0
for i in range(N+1):
    for j in range(i+1, N+1):
        l = 0
        for c in 'ACGT':
            l += S[i:j].count(c)
        if l == j - i:
            ans = max(ans, l)
print(ans)
# Judge status: Accepted
def main():
    import sys
    S=sys.stdin.readline().strip()
    if S[-1]=='s':
        print(S+'es')
    else:
        print(S+'s')

main()
# Judge status: Wrong Answer
n = int(input())
p = list(input())
del p[n:]
p="".join(p)
print(p)
# Judge status: Accepted
mod = 998244353
n = int(input())
d = list(map(int,input().split()))
from collections import Counter
c = Counter(d)
ans = 1
b = 1
if c[0]!=1 or d[0]!=0:ans = 0 
for i in range(max(d)+1):
    ans = (ans*b**c[i])%mod
    b = c[i]
print(ans)
# Judge status: Wrong Answer
k = int(input())

sevens = [0] * k

sevens[0] = 7 % k

if k == 7:
    print(1)
else:
    for i in range(1, k):
        new = (sevens[i - 1] * 10 + 7) % k
        sevens[i] = new

        if new == 0:
            print(i + 1)
            break
    else:
        print(-1)
# Judge status: Accepted
n=int(input())
l6=[6**i for i in range(7)]
l9=[9**i for i in range(1,6)]
m=l6+l9
m.sort()
inf=float("inf")
dp=[inf]*(10**5+1)
dp[0]=0
dp[1]=1
for i in range(1,n+1):
  for mi in m:
    if i-mi>=0:
      dp[i]=min(dp[i-mi]+1,dp[i])
print(dp[n])
# Judge status: Accepted
n,k = map(int,input().split())
L = list(map(int,input().split()))
num = [1,2,3,4,5,6,7,8,9,0]
li = list(set(num).difference(set(L)))

flag = False
while True:
    n = str(n)
    for i in range(len(n)):
        if int(n[i]) in li:
            flag = True
        else:
            flag= False
            break
    if flag:
        print(n)
        exit()
    n = int(n)
    n +=1
# Judge status: Accepted
T = input()

print(T.replace('?', 'D'))
# Judge status: Wrong Answer
A = int(input())
B = int(input())
C = int(input())
X = int(input())

result = 0

for i in range(A // 500 + 1):
    for j in range(B // 100 + 1):
        for k in range(C // 50 + 1):
            if (i * 500 + j * 100 + k * 50) == X:
                result += 1

print(result)
# Judge status: Wrong Answer
N=input()
N=int(N)

if N%2==1:
    N=int(((N-1)/2)+1)
    print(N)
else:
    N=int(N)
    print(N)
# Judge status: Accepted
a,b = map(int,input().split())

if a >= 13:
    print(b)
elif a >= 6:
    print(b//2)
else:
    print(0)
# Judge status: Accepted
N=int(input())
M=N/2+N%2
print(int(M))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
cnt4 = 0
cnt2= 0
for x in a:
    if x%4 == 0:cnt4 +=1
    elif x%2 == 0:cnt2 +=1
odd = n-cnt4 - cnt2
ok = cnt4+1 >= odd
if cnt4+1 == odd:
    if cnt2 >0:ok = False
    
 

if ok:print('Yes')
else:print('No')
# Judge status: Accepted
P, Q, R = map(int, input().split())

print(min(P+Q, Q+R, R+P))
# Judge status: Accepted
x = int(input())

ans = 0
if x <=2:
    ans = x
else:
    for i in range(1, x+1):
        for j in range(2, x+1):
            if i**j <= x:
                ans = max(ans, i**j)
            elif i**j > x:
                break

print(ans)
# Judge status: Wrong Answer
# C - pushpush
N = int(input())
a = list(map(int,input().split()))

lst = [0]*(N-1)
x = a[0]
y = sum(a)-a[0]
lst[0] = abs(x-y)

for i in range(1,N-1):
    lst[i] = abs(lst[i-1] - 2*a[i])

ans = min(lst)
print(ans)
# Judge status: Wrong Answer
import math
A, B, H, M = map(int, input().split())
long_deg = M*60
short_deg = M/2+H*30
rad = (long_deg - short_deg)*2*math.pi/360
print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(rad)))
# Judge status: Wrong Answer
x,y,z=list(map(int,input().split()))
print((x+z)//(y+z))
# Judge status: Wrong Answer
n,d=map(int,input().split())
ans=n//(d*2+1)
if n%(d*2+1)==0:
  ans+1
print(ans)
# Judge status: Accepted
from itertools import accumulate
n,x = map(int,input().split())
lst_l = [0] + list(map(int,input().split()))
lst_wa = list(accumulate(lst_l))
cnt = 0
for i in lst_wa:
    if i <= x:
        cnt += 1
print(cnt)
# Judge status: Accepted
n, m = map(int, input().split())
h = list(map(int, input().split()))

hantei = [1]*n

for i in range(m):
    data = list(map(int, input().split()))

    if h[data[0]-1] < h[data[1]-1]:
        hantei[data[0]-1] = 0
    elif h[data[0]-1] > h[data[1]-1]:
        hantei[data[1]-1] = 0
    else:
        hantei[data[0]-1] = 0
        hantei[data[1]-1] = 0

print(sum(hantei))
# Judge status: Wrong Answer
k = int(input())

rem = 0
for i in range(k):
    rem = rem*10 + 7
    rem %= k
    if rem==0:
        break

if i==(k-1):
    print(-1)
else:
    print(i+1)
# Judge status: Wrong Answer
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=min(a,b,c,d,e)
print(n//k + 5)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a+b+c <= 21:
    print("win")
else:
    print("bust")
# Judge status: Accepted
import numpy as np

a = []
for _ in range(3):
    a.append([int(i) for i in input().split()])
a = [e for row in a for e in row]
for i in range(int(input())):
    b = int(input())
    if b in a:
        a[a.index(b)] = 0
bingo = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
flg = 0
for i in range(len(bingo)):
    c = 0
    for j in bingo[i]:
        c += a[j]
    if c==0:
        flg = 1
        break
print('Yes' if flg==1 else 'No')
# Judge status: Accepted
s = input()

alphabets = 'abcdefghijklmnopqrstuvwxyz'
for i in s:
  alphabets = alphabets.replace(i, '')
  s = s.replace(i, '')

alphabets = [i for i in alphabets]
alphabets.sort()
if len(alphabets) > 0:
  print(alphabets[0])
else:
  print('None')
# Judge status: Accepted
a, b, c = map(int, input().split())
if ((a+b+c) >= 22):
    print("bust")
else:
    print("win")
# Judge status: Wrong Answer
import random
print(random.randint(0,1))
# Judge status: Wrong Answer
a=int(input())
if a<10:
  print(a)
if 10<=a<100:
  print(9)
if 100<=a<1000:
  print(9+a-99)
if 1000<=a<10000:
  print(910)
if 10000<=a<100000:
  print(909+a-9999)
if 100000<=a<1000000:
  print(90909)
# Judge status: Accepted
import numpy as np

D=int(input())
C=np.array(list(map(int,input().split())))
S=[]
S_sa=[]
sa=[]
for i in range(D):
    s=np.array(list(map(int,input().split())))
    sa=s-C
    S_sa.append(sa)
    S.append(s)

minus=365*sum(C)

for i in range(D):
    A=S_sa[i].tolist()
    ma=max(S_sa[i])
    print(A.index(ma)+1)
# Judge status: Accepted
s = input()
t = input()

d = len(s) - len(t)
min_c = int(1e4)
for i in range(d+1):
    st = s[i:i+len(t)]
    c = 0
    for j in range(len(t)):
        if st[j] != t[j]:
            c += 1
            if c > min_c:
                break
    min_c = min(c, min_c)

print(min_c)
# Judge status: Accepted
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
A, B = map(int, input().split())
S = str(input())

if S[A] != "-" :
  print ("No")
  exit()

#print (S[0:A])
#print (S[A+1:])

try:
  d1 = int(S[0:A])
  d2 = int(S[A+1:])
except:
  print ("No")
  exit()

if d1 < 0 or d2 < 0 :
  print ("No")
  exit()
    
print ("Yes")
# Judge status: Wrong Answer
import math
N = int(input())
print(math.ceil((1+math.sqrt(1+8*N+0.000001))/2))
# Judge status: Accepted
from itertools import accumulate
N, K = map(int, input().split())
P = list(map(int, input().split()))
acc = [0] + list(accumulate(P))
print((max(b - a for a, b in zip(acc, acc[K:])) + K) / 2)
# Judge status: Accepted
N, M = map(int, input().split())
for i,m in enumerate(range(M, 0, -1)):
    if m % 2:
        i = i // 2
        print(str(i+1) + " " + str(i+1+m))
    else:
        i = i // 2
        print(str(N - i - m) + " " + str(N - i))
# Judge status: Wrong Answer
N,M=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
A=sorted(A,key=lambda x:x[0])
s=0 #本数
t=0 #値段
for i in range(N):
  s+=A[i][1]
  if M>s:
    t+=A[i][0]*A[i][1]
  else:
    over=s-M
    t-=A[i][0]*over
print(t)
# Judge status: Accepted
# 【ご報告】さんざん悪態をつきましたが「"裏"の数」だってのをn,m=1,1の場合に限ってなんかよくわからんが表にしてたのが原因でした ジャッジは悪くない
n, m = map(int, input().split())
if n == m == 1:
    print(1)
elif n == 1 or m == 1:
    print(max(n, m) - 2)
else:
    print(n * m - (n * 2 + (m - 2) * 2))
# Judge status: Accepted
n = int(input())

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

dp = [[0]*3 for _ in range(n)]
dp[0] = vals[0]

for i in range(1, n):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + vals[i][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + vals[i][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + vals[i][2]

print(max(dp[n-1]))
# Judge status: Accepted
# coding: utf-8

import sys

N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
	txy = [int(x) for x in input().split()]
	t.append(txy[0])
	x.append(txy[1])
	y.append(txy[2])

for i in range(N):
	d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
	dt = t[i + 1] - t[i]
	if dt < d or dt % 2 != d % 2:
		print("No")
		sys.exit()
	
print("Yes")
# Judge status: Accepted
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

s = list(map(int,input()))
print(sum(s))

# メモ
# sに入力を一文字ずつ配列に入れ、それの合計を出した
# Judge status: Accepted
X, Y = map(int, input().split())
print(int(X+Y/2))
# Judge status: Accepted
N = int(input())
A = [int(x) for x in input().split()]

last = 0
ans = 1

for i in range(N - 1):
    diff = A[i] - A[i + 1]
    if last == 0:
        if diff > 0:
            last = 1
        elif diff < 0:
            last = -1
    elif last * diff < 0:
        ans += 1
        last = 0

print(ans)
# Judge status: Accepted
A, B = map(int, input().split())

cnt = 0
for i in range(A, B+1):
    s = str(i)
    if s == s[::-1]:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
k,n=map(int, input().split())
a=list(map(int,input().split()))
t=k/2
min1=t
max1=0
min2=k
max2=t
for i in range(n):
    if a[i]<=t:
        if a[i]<min1:
            min1=a[i]
        if a[i]>max1:
            max1=a[i]
    else:
        if a[i]<min2:
            min2=a[i]
        if a[i]>max2:
            max2=a[i]
print(int(min(k-min2+max1,max2-min1)))
# Judge status: Wrong Answer
n=int(input())
inf=10**9+7
a=list(map(int,input().split()))
import numpy as np
arr_a=np.array(a)
s=np.sum(arr_a)
norm=np.sum(arr_a**2)
x=(s**2-norm)//2
print(x-(x//inf)*inf)
# Judge status: Accepted
n = int(input())
print(len(set([input() for _ in range(n)])))
# Judge status: Accepted
ab,bc,ca=map(int,input().split())
print(int(ab*bc/2))
# Judge status: Accepted
#!/usr/bin/env python3
n, *x = map(int, open(0).read().split())
s = sorted(x)
m1 = s[n // 2 - 1]
m2 = s[n // 2]
for i in x:
    if i < m2:
        print(m2)
    else:
        print(m1)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = round(sum(a)/n)
c = [(x-b)**2 for x in a]
print(sum(c))
# Judge status: Accepted
A,B,K=map(int,input().split())
if B-A+1<2*K:
  for i in range(A,B+1):
    print(i)
  exit()
l=list()
for i in range(A,A+K):
  l.append(i)
for i in range(B-K+1,B+1):
  l.append(i)

for i in range(len(l)):
  print(l[i])
# Judge status: Accepted
s1 = input()
s2 = input()

A = []
for i in range(len(s1)):
    a = s1[:i]
    b = s1[i:]
    A.append(b+a)

if s2 in A:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import fractions
from functools import reduce

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

print(reduce(fractions.gcd, A))
# Judge status: Accepted
S = input()
N = len(S)
for i in range(len(S) // 2 - 1, -1, -1):
    if S[:i] == S[i : 2 * i]:
        print(2 * i)
        break
# Judge status: Accepted
x,a,b = map(int,input().split())
print("A" if abs(a-x)<abs(b-x) else "B")
# Judge status: Accepted
n, x = map(int, input().split())
L = list(map(int, input().split()))
cnt = 1
d = 0
for i in range(len(L)):
    d += L[i]
    if d > x:
        break
    cnt += 1

print(cnt)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
ans=[]
for i in range(a,min(k,b)+1):
  ans.append(i)
for i in range(max(b-k,a),b+1):
  ans.append(i)
ans = list(set(ans))
for i in ans:
  print(i)
# Judge status: Accepted
a,b,c=map(int,input().split())
k=int(input())
while a>=b and k>0:
    b*=2
    k-=1
while b>=c and k>0:
    c*=2
    k-=1
if a<b<c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
MOD = int(1e9 + 7)
n=int(input())
print(10 ** n % MOD - 9 ** n % MOD - 9 ** n % MOD + 8 ** n % MOD)
# Judge status: Wrong Answer
import numpy

e=input().split()
for i in range(len(e)):
  e[i]=int(e[i])
x=e[0]
k=e[1]
d=e[2]
t=k
if k>10000:
 if k%2==0:
   t=10000
 else:
   t=10001
kou=numpy.gcd(x,d)
x=int(x/kou)
d=int(d/kou)
if d>100 and d%2==0:
  d=100
if d>100 and d%2==1:
  d=1001
for i in range(t):
  if abs(x+d)<abs(x-d):
    x+=d
  else:
    x-=d
print(abs(x)*kou)
# Judge status: Wrong Answer
a,b = map(int,input().split())
ansl = []
if min(a,b) == 1:
  print(max(a,b))
else:
  for i in range(1,min(a,b)//2+1):
    if a%i == 0 and b%i == 0:
      ansl.append(i)
  if not ansl:
    print(a*b)
  else:
    print(int(a*b/max(ansl)))
# Judge status: Accepted
x = int(input())
e = x // 11
d = x - e * 11

if d > 6:
    print(e*2 + 2)
elif 0 < d <= 6:
    print(e*2 + 1)
else:
    print(e*2)
# Judge status: Wrong Answer
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
f = True
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or dist%2 != time%2:
        f = False
        break       
print('Yes' if f else 'No')
# Judge status: Accepted
# 数列aの最小値min_aの最大値はM//N
# 他の要素がmin_aの倍数であれば、min_aが最大公約数となる
# すなわち、(M-min_a)をmin_aで割った余りが0でありかつ、商がN-1以上
 
N, M = map(int, input().split())
 
for i in range(M//N, 0, -1):
    r, q = divmod((M - i), i)
    if r >= N - 1 and q == 0:
        break
print(i)
# Judge status: Accepted
X,K,D=map(int,input().split())
if D*K<abs(X):
  print(abs(X)-D*K)
else:
  K2=abs(X)//D
  if K2>K:
    K2=K
  if (K-K2)%2==0:
    print(abs(X)-K2*D)
  else:
    ans=min(abs(X)-(K2-1)*D, (K2+1)*D-abs(X))
    print(ans)
# Judge status: Accepted
import decimal
l=input()
l=decimal.Decimal(l)
m=decimal.Decimal(3)
print((l/m)**3)
# Judge status: Accepted
a, b, c = map(int, input().split())
print('YES' if (a * 100 + b * 10 + c) % 4 == 0 else 'NO')
# Judge status: Accepted
import sys
n = int(input())
w = list(map(int,input().split()))
a = 0
b  = sum(w)
for i in range(n):
    a += w[i]
    b -= w[i]
    if a > b:
        print(min(a-b,2*w[i]-a+b))
        sys.exit()
# Judge status: Accepted
A,B = map(int,input().split())
S = str(input())

flg = True
skip = A
cnt=0

if len(S) != A+B+1:
    flg=False
    

for i in range(len(S)):
    
    if cnt == A:
        if S[cnt]!= "-":
            flg = False
    else:
        if S[cnt] == "-":
            flg = False

    cnt+=1
    
if flg ==True:
    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: Wrong Answer
# import math これだとエラーになる 3.4なので
from fractions import gcd
a, b = map(int, input().split())

hoge = (a*b) / gcd(a, b)
print(hoge)
# Judge status: Accepted
n = input()
if '9' in n:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N=int(input())
#b,c=int(input()),int(input())
# c=[]
#  for i in b:
#     c.append(i)
#e1,e2 = map(int,input().split())
A = list(map(int,input().split()))
#j = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
A.sort()
ans="Yes"
for i in range(1,N):
    if A[i-1]==A[i]:
        ans="NO"
        break
print(ans)
# Judge status: Accepted
import math
a,b=map(int,input().split())
i=1
while i<=1000:
    if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
        print(i)
        exit()
    i+=1
print(-1)
# Judge status: Accepted
S = input()

if int(S[:2]) == 0 and 0 < int(S[2:]) <= 12:
  print("YYMM")
elif int(S[2:]) == 0 and 0 < int(S[:2]) <= 12:
  print("MMYY")
elif int(S[:2]) == 0 or int(S[2:]) == 0 or (int(S[:2]) > 12 and int(S[2:]) > 12):
  print("NA")
elif int(S[:2]) > 12 and int(S[2:]) <= 12:
  print("YYMM")
elif int(S[:2]) <= 12 and int(S[2:]) > 12:
  print("MMYY")
else:
  print("AMBIGUOUS")
# Judge status: Wrong Answer
from sys import stdin
from math import ceil, floor
n,a,b=[int(x) for x in stdin.readline().rstrip().split()]
s=list(stdin.readline().rstrip())
c=a+b
d=e=m=0
for i in range(n):
    if d>=c:
        m=i+1
        break
    if d<c and s[i]=="a":
        print("Yes")
        d+=1
    elif d<c and e<b and s[i]=="b":
        print("Yes")
        d+=1
        e+=1
    else:
        print("No")
if m != 0:
    for i in range(n-m):
        print("No")
# Judge status: Accepted
from collections import defaultdict
def main():
    N = int( input())
    A = list( map( int, input().split()))
    d = defaultdict( int)
    for a in A:
        d[a] += 1
    ans = 0
    for key, value in d.items():
        if key > value:
            ans += value
        elif key < value:
            ans += value - key
    print(ans)
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=[-1 for _ in range(n)]
for i in range(n):
  j=n-i
  if n//j<2:
    ans[j-1]=a[j-1]
  else:
    p=sum(a[2*j-1::j])
    ans[j-1]=abs(a[j-1]-p)
b=[0 for _ in range(sum(ans))]
i=0
#print(ans)#######
m=sum(ans)
for j in range(n):
  if ans[j]!=1 or ans[j]!=0:
    print(-1)
    exit()
  if ans[j]==1:
    b[i]=j+1
    i+=1

print(m)
print(*b)
# Judge status: Accepted
N, M = map(int,input().split())
city = [0]*N
for _ in range(M):
  a_i, b_i = map(int,input().split())
  city[a_i-1]+=1
  city[b_i-1]+=1
for i in range(N):
  print(city[i])
# Judge status: Accepted
dish = [int(input()) for x in range(5)]
hitoketa = list(map(int, [str(x)[-1] for x in dish]))

last = 999
for i in hitoketa:
    if not i % 10 == 0:
        last = min(last, i)

if last != 999:
    last = dish[hitoketa.index(last)]
else:
    last = dish[0]

ans = last
skip = False

for i in dish:
    if i == last and not skip:
        skip = True
    elif i % 10 == 0:
        ans += i
    else:
        ans += (i // 10 + 1) * 10

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _ in range(n)]

ans, tmp = 0, 0
for ai in a:
    ans += (ai + tmp) // 2 
    tmp = abs(tmp - ai % 2)
print(ans)
# Judge status: Accepted
s = input()

ans = "No"
if s == "hi":
    ans = "Yes"
elif s == "hihi":
    ans = "Yes"
elif s == "hihihi":
    ans = "Yes"
elif s == "hihihihi":
    ans = "Yes"
elif s == "hihihihihi":
    ans = "Yes"

print(ans)
# Judge status: Wrong Answer
n,d = map(int,input().split())
x = [list(map(int,input().split())) for i in range(n)]
count = 0

import numpy as np
for i in range(n-1):
    for j in range(1,n):
        a = np.array(x[i])
        b = np.array(x[j])
        ab = sum(np.power((a-b),2))**0.5
        if ab%1 == 0:
            count += 1
print(count)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n+1:2]))
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()
    N = len(S)

    if S != S[::-1]:
        print("No")
        return

    tmp = S[:(N - 1) // 2]
    if tmp != tmp[::-1]:
        print("No")
        return

    tmp = S[(N + 3) // 2 - 1:]
    if tmp != tmp[::-1]:
        print("No")
        return

    print("Yes")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S = input()
ans = "X" * len(S)
print(ans)
# Judge status: Accepted
N,K = map(int,input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)
r = 10**10

for i in range(N-K+1):
  r = min(r,h[i+K-1]-h[i])
print(r)
# Judge status: Accepted
import numpy as np
n, m = list(map(int, input().split()))

a = np.array(list(map(int, input().split())))

total = np.sum(a)
#print(len(a[a>=total/(4*m)]))

if len(a[a>=total/(4*m)])>=m:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

n = iin()
d = [int(x) for x in input().split()]
d.sort()

neko = int(n/2 - 1)
nuko = neko + 1
if d[neko] != d[nuko]:
    for i in range(d[nuko]-d[neko]):
        nya = nya + 1
    
print(nya)
# Judge status: Accepted
x = int(input())

def Eratosthenes(x):
    n = [i for i in range(2,x+1)]
    prime_list = []

    while True:
        if n[0] >= x**0.5:
            prime_list.extend(n)
            break
        tmp = n.pop(0)
        prime_list.append(tmp)
        n = [i for i in n if i % tmp != 0]

    return prime_list

primes = Eratosthenes(10**5+3)

ans = x
while True:
    if x in primes:
        print(x)
        break
    else:
        x += 1
# Judge status: Accepted
import itertools

n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))

l = [i for i in range(1,n+1)]

r=[]
for v in itertools.permutations(l):
    r.append(v)
    
pp=r.index(p)
qq=r.index(q)
print(abs(pp-qq))
# Judge status: Accepted
import math

def main():
    a, b, x = map(int, input().split())

    if x > a * a * b * 0.5:
        theta = math.atan(2*(a*a*b-x)/(a*a*a))
    else:
        theta = math.atan(a*b*b/(2*x))

    print(theta*180/math.pi)

if __name__ == '__main__':
    main()