peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,m = map(int, input().split()) 

pena=[0]*(n+1)
seitou=[0]*(n+1)

for i in range(m):
    p,s = map(str,input().split()) 
    p=int(p)
    if s=="WA" and seitou[p]==0:
        pena[p]+=1
    if s=="AC":
        seitou[p]=1

pena_kazu=0

for i in range(1,n+1):
    if seitou[i]==1:
        pena_kazu+=pena[i]

seitou_kazu=sum(seitou)

print(str(seitou_kazu)+" "+str(pena_kazu))
# Judge status: Wrong Answer
n = int(input())
a = [int(i) for i in input().split()]
f = True
for i in a:
    if i % 2:
        continue
    elif i % 3 != 0 or i % 5 != 0:
        f = False
        break

print('APPROVED' if f else 'DENIED')
# Judge status: Accepted
N = int(input())
CSFlist = [list(map(int, input().split())) for _ in range(N-1)]
def calc_time(start):
    now = 0
    for i in range(start, N-1):
        C, S, F = CSFlist[i]
        if now < S:
            now = S
        if now % F != 0:
            now += F - now % F
        now += C
    return now
for _ in range(N-1):
    print(calc_time(_))
print(0)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

res = 0
b = A[N//2 - 1] - (N//2)
print(b)
for i in range(N):
    res += abs((i+b+1) - A[i])
print(res)
# Judge status: Accepted
k, x = list(map(int, input().split()))
if k * 500 >= x:
    print("Yes")
else:
    print("No")
# Judge status: Accepted

sx,sy,tx,ty = map(int,input().split())
for i in range(tx-sx):
    print("R",end = "")
for i in range(ty-sy):
    print("U",end = "")
for i in range(tx-sx):
    print("L",end = "")
for i in range(ty-sy):
    print("D",end = "")
print("D",end = "")
for i in range(tx-sx+1):
    print("R",end = "")
for i in range(ty-sy+1):
    print("U",end = "")
print("L",end = "")
print("U",end = "")
for i in range(tx-sx+1):
    print("L",end = "")
for i in range(ty-sy+1):
    print("D",end = "")
print("R")
# Judge status: Accepted
N, M = map(int, input().split())
slist = []
plist = []

for i in range(N):
  a, b = map(int, input().split())
  slist.append([a,b])  
  
for i in range(M):
  c, d = map(int, input().split())
  plist.append([c,d])

for i in range(N):
  list = []
  for j in range(M):
    list.append(abs(slist[i][0] - plist[j][0]) + abs(slist[i][1] - plist[j][1]))
  print(list.index(min(list)) + 1)
# Judge status: Accepted
N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()
if N%2==0:
    print(B[N//2-1] + B[N//2] - (A[N//2-1] + A[N//2]) + 1)
else:
    print(B[(N-1)//2] - A[(N-1)//2] + 1)
# Judge status: Wrong Answer
n, m = map(int, input().split())

if n == 1 or m == 1:
    ans = max(n, m) - 2
else:
    ans = n * m - 2 * n - 2 * m + 4

print(ans)
# Judge status: Accepted
from collections import Counter
N = int(input())
ans = 0
C = Counter([])
for a in range(1, N + 1):
    for b in range(1, N + 1):
        if a * b >= N:
            break
        ans += 1
        if a == b:
            C[a * b] += 1

for v in C.values():
    if v >= 2:
        ans -= (v - 1)
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=[]
l=0
for i in range(n):
  t=list(bin(a[i]))
  l=max(l,len(t)-2)
  temp=0
  for j in range(2,len(t)):
    if t[j]=="0":
      temp=temp+2**(len(t)-j-1)
    tl=len(t)-2
  while tl<l:
    temp=temp+2**(l-(tl-l)-2)
    tl=tl+1
  ans.append(str(temp))
print(" ".join(ans))
# Judge status: Accepted
n = int(input())
H = list(map(int,input().split()))

for i in range(1,n-1):
    if H[n-1-i] == H[n-i] + 1:
        H[n-1-i] -= 1
    elif not(H[n-1-i] == H[n-i] or H[n-1-i] < H[n-i]):
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
N = int(input())
if N%2 != 0:
    print(((N+1)/2)/N)
if N%2 == 0:
    print(1/2)
# Judge status: Accepted
N = int(input())  #数字
S = list(input() for i in range(N))  #スペース抜きの単語を複数行

S = set(S)

print(len(S))
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))

num = {}
ans = 0
for i, v in enumerate(A):
    p = v+i
    m = i-v
    if p not in num:
        num[p] = 1
    else:
        num[p] += 1
    if m in num:
        ans += num[m]
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
print(a*b)
# Judge status: Accepted
d = int(input())
cristmas = {
    22:'Christmas Eve Eve Eve',
    23:'Christmas Eve Eve',
    24:'Christmas Eve',
    25:'Christmas'
}
print(cristmas[d])
# Judge status: Accepted
N = int(input())
MOD = 1_000_000_007
A = pow(10, N, MOD) - pow(9, N, MOD)
AorB = pow(10, N, MOD) - pow(8, N, MOD)
print( (A * 2  - AorB) % MOD if N > 1 else 0)
# Judge status: Accepted
x, k, d = map(int, input().split())

x = abs(x)

if x >= k * d:
    print(x - k * d)
else:
    div, mod = divmod(x, d)
    if (k - div) % 2 == 0:
        print(mod)
    else:
        print(abs(mod - d))
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
count=0

for i in range(0,n-2):
    #print(i)
    p_list=[p[i],p[i+1],p[i+2]]
    #print(p_list)
    p_sorted=sorted(p_list)
    #print(p_sorted)
    if p_list[1]==p_sorted[1]:
        count+=1

print(count)
# Judge status: Accepted
x = int(input())

if x == 3 or x == 5 or x ==7:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
n,m=list(map(int,input().split()))
d={}
for _ in range(n):
    a, b = list(map(int, input().split()))
    d[a]=b

sd=dict(sorted(d.items()))

result=0
ans=0
for i in sd:
	result+=d[i]
	ans+=i*d[i]
	if result>=m:
		ans-=i*(result-m)
		break
print(ans)
# Judge status: Accepted
n = int(input()[-1])
if n in [2,4,5,7,9]:
    print('hon')
elif n in [0,1,6,8]:
    print('pon')
else:
    print('bon')
# Judge status: Accepted
li = list(input())
li.sort()
s = ''
for i in li:
  s += i
if s == 'abc':
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a, b, c, d = input()
print("Yes" if a==b==c or b==c==d else "No")
# Judge status: Accepted
print(['YES','NO'][sum(list(map(int,input().split()))) != 17])
# Judge status: Wrong Answer
def ch_min(a, b):
    if (a > b):
        a = b
    return a


if __name__ == "__main__":
    N = int(input())
    h = list(map(int, input().split()))
    INF = 10 ** 10
    dp = [INF] * 100010
    dp[0] = 0
    for i in range(N):
        dp[i + 1] = ch_min(dp[i], dp[i] + abs(h[i] - h[i - 1]))
        if (i > 1):
            dp[i + 2] = ch_min(dp[i], dp[i] + abs(h[i] - h[i - 2]))
    print(dp[N - 1])
# Judge status: Accepted
#!/usr/bin/env python3
n, l = map(int, input().split())

li = list(i for i in range(1, n+1, 1))
ab = 10000
ans = 0

for i in li:
  if abs(l + i - 1) < ab:
    ab = abs(l + i - 1)
    ans = l + i - 1

su = sum(li) + n * l - n

print(su - ans)
# Judge status: Wrong Answer
n = int(input())
s = input()
if s[:(n//2-1)]==s[:(n//2-1)]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,k = map(int,input().split());
i = 0;
if n == k:
    print(0);
elif n < k:
    print(min(n,k-n));
else:
    v = (n - k)%k;
    if v*2 >= k:
        print(k-v);
    else:
        print(v);
# Judge status: Accepted
# coding: UTF-8
import sys
import numpy as np
import math


n = int(input())
aList = list(map(int, input().split()))
numMinus = 0
for i in range(n):
	if aList[i] < 0:
		numMinus += 1
		aList[i] *= -1

aList.sort()

if numMinus % 2 == 0:
	print(sum(aList))
else:
	print(sum(aList) - 2 * aList[0])
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
import sys
 
def main():
  alist = [
    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
    "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
    "u", "v", "w", "x", "y", "z",
  ]
 
  input = sys.stdin.readline()
  print(input)
  
  i = 0
  for a in alist:
    if str(input) == a:
      print(alist[i+1])
    i += 1
 
if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
X, Y = list(map(int, input().split()))
for i in range(1,X+1):
    if 2*i + 4*(X-i) == Y:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
i,j,k=input().split()
print(i[0]+j[0]+k[0])
# Judge status: Accepted
import sys
n = int(input())
s = sorted([int(input()) for _ in range(n)])
cnt = 0
x = sum(s)

if x % 10 != 0:
    print(x)
    sys.exit()

for num in s:
    if num % 10 == 0:
        cnt += 1
if cnt == len(s):
    print(0)
    sys.exit()
    
for i in range(n):
    if s[i] % 10 != 0:
        del s[i]
        break
print(sum(s))
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(((N-2) // (K-1))+1)
# Judge status: Wrong Answer
X, Y = map(int, input().split())
if Y % X == 0:
  ans = -1
else:
  ans = X
print(ans)
# Judge status: Wrong Answer
#049_C
s = input()

s = s.replace('dream', '').replace('dreamr', '').replace('erase', '').replace('eraser', '')
print('YES' if s == '' else 'NO')
# Judge status: Accepted
l = list(map(int, input().split()))

flg = True
for i in l:
    if i % 2 == 0:
        flg = False

if flg:
    l.remove(max(l))
    print(l[0] * l[1])
else:
    print(0)
# Judge status: Accepted
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math
import functools

n = input()
for i in range(len(n)):
    if n[i] == "9":
        print("Yes")
        sys.exit()
print("No")
# Judge status: Accepted
N = int(input()) 
num = N // 11
res = num * 2
k = num * 11
if 0< N % 11 <= 6:
  res +=  1
elif 7<= N % 11 <= 10:
  res +=  2
else:
  pass  
print(res)
# Judge status: Wrong Answer
# input
H = int(input())

M = [H]
cnt = 0

print(M)

while [1] * len(M) != M:

    target = [(idx, m) for idx, m in enumerate(M) if m > 1]
    for idx, m in target:
        M += [m // 2, m // 2]
        M.remove(m)
        cnt += 1

    print(M)

print(cnt + len(M))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
for i in range(N):
    A[i]-=i
B=sorted(A)
x=B[N//2]
print(sum(abs(A[i]-x) for i in range(N)))
# Judge status: Accepted
N, K, S = map(int, input().split())
ans = [str(ele) for ele in ([S] * K + [(S - 1) if S != 1 else 10**9] * (N - K))]
print(" ".join(ans))
# Judge status: Accepted
w, a, b = map(int,input().split())
hidari = min(a,b)
migi = max(a,b)
sa = migi - hidari
r = 0

if sa <= w:
  r = 0
else:
  r = sa - w
print(r)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

l1 = 0
l2 = sum(a)
d = l2
for i in range(n):
    l1 += a[i]
    d = min(d, abs(2*l1 - l2))
print(d)
# Judge status: Accepted
from collections import Counter
n, x, y = map(int, input().split())

def func(i,j,x=x,y=y):
  return min(abs(j-i), abs(x-i)+1+abs(y-j))

count = []
for i in range(1,n):
  for j in range(i+1, n+1):
    count.append(func(i,j))
    
counted = Counter(count)
for i in range(1,n):
    print(str(counted[i]))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)

d = {}
for a in A:
  d.setdefault(a,0)
  d[a] += 1
  
A = sorted(set(A))
t = [True] * (10 ** 6 + 1)
for a in A:
    if d[a] > 1:
        t[a] = False
    for i in range(a + a, 10 ** 6 + 1, a):
        t[i] = False
print(sum(1 for a in A if t[a]))
# Judge status: Accepted
N = int(input())
a1 = 0
a2 = 0
a1_ind = -1

for i in range(0,N):
    x = int(input())
    if a1 < x:
        a2 = a1
        a1 = x
        a1_ind = i
    elif a2 < x:
        a2 = x

for i in range(0,N):
    if i == a1_ind:
        print(a2)
    else:
        print(a1)
# Judge status: Accepted
from decimal import Decimal
a,b,c = map(Decimal, input().split())
print('Yes' if 4*a*b < (c-a-b)**2 and c-a-b >= 0 else 'No')
# Judge status: Accepted
a=1
mod=10**9+7
n=int(input())
for i in range(1,n+1):
    a=(a*i)%mod
    a%=mod
print(a)
# Judge status: Accepted
n = input()
precise = 0
ok_over = 1
ok_prec = 0
for d in n:
    d = int(d)
    new_over = min(precise + d + 1, ok_over + d + 2, ok_over + 9 - d, ok_prec + d + 1)
    new_prec = min(ok_over + d + 1, ok_prec + d)
    precise += d
    ok_over = new_over
    ok_prec = new_prec
ok_over += 1
print(min(precise, ok_over, ok_prec))
# Judge status: Accepted
N,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(N-1):
    if a[i] + a[i+1] > x:
        y = a[i] + a[i+1] - x
        ans += y
        a[i+1] = max(0,a[i+1]-y)
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
N, M = map(int, input().split())
S = [[*map(int, input().split())] for _ in range(N)]
C = [[*map(int, input().split())] for _ in range(M)]
for a, b in S:
    mi = 10**9
    ans = 51
    for i in range(M):
        c, d = C[i]
        if abs(a - c) + abs(b - d) < mi:
            ans = i + 1
            mi = abs(a - c) + abs(b - d)
    print(ans)
# Judge status: Wrong Answer
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)
count_dict = [0] * N
for each in a_types:
    count_dict[each - 1] = A.count(each)

for each in A:
    count_dict[each - 1] += 1

all_types = 0
for value in count_dict:
    all_types += value * (value - 1) // 2

# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1

for a in A:
    print(all_types - count_dict[a - 1] + 1)
# Judge status: Accepted
flag=True
S=input()
for i in range(len(S)//2):
  if S[i]!=S[len(S)-1-i]:
    flag=False
if flag:
  for i in range(((len(S)-1)//2)//2):
    if S[i]!=S[(len(S)-1)//2-i-1]:
      flag=False
if flag:
  if S[:(len(S)-1)//2]!=S[(len(S)+3)//2-1:]:
    flag=False
if flag:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,k = map(int,input().split())
a = [int(i) for i in input().split() ]

d = {}
for i in a:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1
    
    
d = sorted(d.values())
if len(d) > k:
  ans = 0
  for i in range(len(d)-k):
    ans += d[i]
  print(ans)
else:
  print(0)
# Judge status: Wrong Answer
A,B,C = input().split()
if C >= A and C <= B:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N = int(input())

S = input()

min_num = N+1

W = []
E = []

w_cnt = 0
e_cnt = 0

for i in range(N):
    if S[i] == 'W':
        w_cnt += 1
    W.append(w_cnt)

for i in range(N-1,0,-1):
    min_num = min(min_num,W[i-1]+e_cnt)
    if S[i] == 'E':
        e_cnt += 1

print(min(min_num,e_cnt))
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(1,n-1):
    if p[i] != max(p[i-1],p[i],p[i+1]) and p[i] != min(p[i-1],p[i],p[i+1]):
        count += 1
print(count)
# Judge status: Accepted
*a,b=map(int,open(0).read().split());print(sum(a)+max(a)*(2**b-1))
# Judge status: Accepted
n, m = map(int, input().split())
l = list(map(int, input().split()))

def gcd(x, y):
    return x if y == 0 else gcd(y, x % y)
def lcm(x, y):
    return (x * y) // gcd(x, y)

k = 1

for i in l:
    i //= 2
    k = lcm(k, i)
    if (k // i) % 2 == 0 or k > m:
        print(0)
        break
else:
    print(m // k - m // (k * 2))
# Judge status: Wrong Answer
import math
N, K = map(int, input().split())

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

def cal(x):
    s = 0
    for aa in a:
        s += math.ceil(aa/x) - 1
    if s <= K: return True
    else: return False

l = 1
r = max(a)
while (r - l) > 1:
    mid = (l + r) // 2
    if cal(mid):
        r = mid
    else:
        l = mid
print(r)
# Judge status: Accepted
a, b, h = int(input()), int(input()), int(input())
print((a+b)*h//2)
# Judge status: Wrong Answer
x = int(input())
y = []
count1 = 0
flag = 0
for i in range(0, 70):
  y.append(i*i*i*i*i)
for i in y:
  if i == x:
    print("0 -" + str(count1))
    flag = 1
    break;
  count1 += 1
count1 = 0
for i in y:
  if flag == 1:
    break;
  count2 = 0
  for j in y[:count1]:
    y2 = i + j
    y3 = i - j
    if y2 == x:
      print(str(count1) + " -" + str(count2))
      break;
    if y3 == x:
      print(str(count1) + " " + str(count2))
      break;
    count2 +=1
  count1 += 1
# Judge status: Accepted
N, X, T = map(int, input().split())
if N%X ==0:
    print((N//X)*T)
else:
    print((N//X + 1)*T)
# Judge status: Accepted
n,x = map(int,input().split())
lst=list(map(int,input().split()))
new_lst=[abs(i-x) for i in lst]

def gcd(x,y):
    if y==0 : return x
    else: return gcd(y,x%y)
#print(gcd(n,x))

ans=new_lst[0]
for i in range(1,n):
	ans =gcd(new_lst[i],ans)
  
print(ans)
# Judge status: Accepted
n, *AB = map(int, open(0).read().split())
A, B = map(sorted, [AB[::2], AB[1::2]])
mid = n//2
a = A[mid]
b = B[mid]
if n % 2 == 0:
    a += A[mid-1]
    b += B[mid-1]
print(b-a+1)
# Judge status: Accepted
A,B,K=map(int,input().split())
list=[]
for i in range(1,min(A,B)+1):
  if A%i==0 and B%i==0 :
    list.append(i)
print(list[len(list)-K])
# Judge status: Accepted
A, B = map(int, input().split())
if (A + B) % 2 == 0:
  print((A + B) // 2)
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
def main():
    S = input()
    print(min(S.count("0"), S.count("1")) * 2)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x,y = [int(hoge) for hoge in input().split()]
if x==y:print(0);exit()
#K回…
#押して反転 or 反転して押す or 反転押して反転
#-x-K or -x + K or x + k or x-k
kouho =  [-x-y+1,x+y+1,y-x,x-y+2]
print(min([k for k in kouho if k>0]))
# Judge status: Accepted
n = int(input())

ok = "No"
for cake in range(0, 26):
    for daunut in range(0, 15):
        if 4 * cake + 7 * daunut == n:
            # print(f"4 * {cake} + 7 * {daunut} == {n}")
            ok = "Yes"
            break
print(ok)
# Judge status: Wrong Answer
n,*h=map(int,open(0).read().split())
h=h+[0]
ans=0
tmp=0
for i in range(n):
  if h[i]-h[i+1]>=0:
    tmp+=1
  else:
    tmp=0
  ans=max(ans,tmp)
print(ans-1)
# Judge status: Wrong Answer
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
cnt = 0
for v in collections.Counter([ri() for _ in range(n)]).values():
    if v&1==0:
        cnt += 1
print(cnt)
# Judge status: Accepted
q,h,s,d=map(int,input().split())
n=int(input())
l = min(q*8, h*4, s*2, d)
if l != d or n % 2 == 0:
  print(l*n//2)
else: print(l*(n//2)+min(q*4, h*2, s))
# Judge status: Accepted
N = int(input())
S = input()
x, max_x = 0, 0

for c in S:
    if c == 'I':
        x += 1
    elif c == 'D':
        x -= 1
    if x > max_x:
        max_x = x
print(max_x)
# Judge status: Accepted
import sys

input = sys.stdin.readline

def main():
    ans = 0
    N = int(input())
    for i in range(1, N):
        ans += (N-1)//i
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b = map(int, input().split())
L = []
for i in range (a,b+1):
  L.append(i)
P = 1
for j in L:
  P *= j
if P > 0:
  print('Positive')
elif P == 0:
  print('Zero')
else:
  print('Negetive')
# Judge status: Accepted
x, a, b=map(int, input().split())
if a>=b:
  print("delicious")
elif a+x>=b:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
from collections import Counter
N = int(input())

cnt = Counter()
for i in range(26):
    s = chr(ord("a")+i)
    cnt[s] = 100
for _ in range(N):
    S = input()
    for i in range(26):
        s = chr(ord("a")+i)
        cnt[s] = min(S.count(s), cnt[s])

res = ""
for i in range(26):
    s = chr(ord("a")+i)
    res += s*cnt[s]

print(res)
# Judge status: Accepted
from collections import defaultdict
dic = defaultdict(int)

N = int(input())
for _ in range(N):
    v = int(input())
    dic[v] += 1

count = 0
for k, v in dic.items():
    if v%2:
        # push
        count += 1
    else:
        # push & pop
        pass
print(count)
# Judge status: Wrong Answer
N=int(input())
S=input()
ans=1
for i in range(N):
  ans=max(ans,len(list(set(list(S[:i+1])) & set(list(S[i+1:])))))
print(ans)
# Judge status: Wrong Answer
from math import ceil
x = int(input())
print(ceil(x / 11) * 2 + (x % 11) // 6 - 1)
# Judge status: Accepted
N , M = map(int,input().split())
Height = [h_i for h_i in map(int,input().split())]
Roots = []
counter = [0 for i in range(N)]
for j in range(M):
    root = [c_i -1 for c_i in map(int,input().split())]
    #print(root)
    if Height[root[0]]<Height[root[1]]:
        counter[root[0]] += 1
    elif Height[root[0]]==Height[root[1]]:
        counter[root[0]] += 1
        counter[root[1]] += 1
    else:
        counter[root[1]] += 1

counter2 = 0
for i in range(N):
    if counter[i]==0:
        counter2+=1
print(counter2)
# Judge status: Wrong Answer
n=input()

ans='No'

if n[0]==7 or n[1]==7 or n[2]==7:
    ans='Yes'
print(ans)
# Judge status: Accepted
xi = input().split()

for i in range(5):
    if xi[i] == "0":
        print(i+1)
        break
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

mon = 0
for i in range(N):
    if A[i] >= B[i]:
        mon += B[i]
    else:
        mon += A[i]
        res = B[i] - A[i]
        if A[i + 1] >= res:
            A[i + 1] = A[i + 1] - res
            mon += res
        else:
            mon += A[i + 1]
            A[i + 1] = 0
    # print(mon)

print(mon)
# Judge status: Accepted
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
l = []


if n >= m:
    print(0)
    exit()

for i in range(m - 1):
    l.append(x[i + 1] - x[i])

l = sorted(l)[::-1]

del l[0: n - 1]

print(sum(l))
# Judge status: Accepted
X=list(map(int,input().split()))

for i in range(5):
    if X[i]==0:
        print(i+1)
# Judge status: Wrong Answer
import math

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

if n == k:
    print(1)
else:
    print(math.ceil(n/(k-1)))
# Judge status: Accepted
n,m=map(int,input().split())
if 2*n>=m:
  print(m//2)
else:
  ans=n
  ans+=(m-2*n)//4
  print(ans)
# Judge status: Accepted
def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

n=int(input())
ans=0
for i in range(1,n+1):
	for j in range(i,n+1):
		for k in range(j,n+1):
			if i!=j!=k:
				ans+=6*gcd(gcd(i,j),k)
			elif i==j==k:
				ans+=i
			else:
				ans+=3*gcd(gcd(i,j),k)
print(ans)
# Judge status: Wrong Answer
n=int(input())
sum=0

for count in range(n):
    if(count%3==0)|(count%5==0):
        continue
    else:
      sum=sum+count
        
print(str(sum))
# Judge status: Accepted
S = input()
print("No" if S == "AAA" or S == "BBB" else "Yes")
# Judge status: Accepted
s = list(str(input()))
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
s = input()
print('Yes' if s[:n//2] == s[n//2:] else 'No')
# Judge status: Wrong Answer
K,X = map(int, input().split())
#総額
SUM = 500*X
#判定
if SUM >= X:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a = int(input())
b =int(input())
h = int(input())

x = (a+b)*h/h
print(int(x))
# Judge status: Accepted
from collections import defaultdict

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

CNT = defaultdict(int)
ans = 0

for i, a in enumerate(A):
    ima = i-a
    if ima in CNT:
        ans += CNT[ima]

    CNT[i+a] += 1

print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
num = 0
for i in A:
    num += i
if A[M-1] >= num//(4*M):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    participants = int(input())
    ratings = list(map(int, input().split()))
    color = [0] * 9
    for rating in ratings:
        color[min(rating // 400, 8)] += 1
    answer = 0
    for i in range(8):
        if color[i] > 0:
            answer += 1
    print(max(1, answer), answer + color[-1])


if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import Counter
def main():
    M = 10 ** 6
    _ = int(input())
    A = list(map(int,input().split()))
    erato = [True] * (M+10)
    m = sorted(Counter(A).items())
    ans = 0
    for t in m:
        if t[1] == 1 and erato[t[0]]:
            ans += 1
        for i in range(t[0],M+1,t[0]):
            erato[i] = False
            
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
A=list(input()[::-1])
B=list(input()[::-1])
C=list(input()[::-1])


next="a"
while True:
  #print(next)
  if next=="a":
    if len(A)==0:
      print("A");exit()
    next=A.pop()    
  elif next=="b":
    if len(B)==0:
      print("B");exit()
    next=B.pop()    
  else:
    if len(C)==0:
      print("C");exit()
    next=C.pop()