Harryxun/stf_run huggingface dataset:
import sympy


def calc():
    n, *a = map(int, open(0).read().split())
    black = set()
    r = set()
    for x in a:
        if x in r:
            black.add(x)
        r.add(x)

    r = set(a)
    count = 0
    for x in r:
        if r & black:
            continue
        if r & set(sympy.divisors(x)[:-1]):
            continue
        count += 1
    return count

print(calc())


### FIXED CODE ###

n, *a = map(int, open(0).read().split())           
a.sort()                                           
s = set()                                          
checked = set()                                    
dup = set()                                        
count = 0                                          
for x in a:                                        
    if x in s:                                     
        if x in checked:                           
            dup.add(x)                             
        continue                                   
    count += 1                                     
    checked.add(x)                                 
    for i in range(1, 10**6 // x + 1):             
        s.add(x * i)                               
                                                   
print(count - len(dup))
a,b = map(int,input().split())

a1 = f"{b}" * a
b1 = f"{a}" * b

print(f"{b1}" if min(a,b)==a else f"{a1}")

### FIXED CODE ###

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

a1 = "{}".format(b)*a
b1 = "{}".format(a)*b

print("{}".format(b1) if min(a,b)==a else "{}".format(a1))
N, M, K = map(int, input().split())
F = [[] for _ in range(N)]
B = [[] for _ in range(N)]

# フレンドの隣接リスト
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    F[a].append(b)
    F[b].append(a)

# ブロックの隣接リスト
for _ in range(K):
    c, d = map(int, input().split())
    c, d = c - 1, d - 1
    B[c].append(d)
    B[d].append(c)


# 交友関係グループ（辞書型）
D = {}
# グループの親
parent = [-1] * N
# 訪問管理
visited = [False] * N

for root in range(N):
    if visited[root]:
        continue

    D[root] = set([root])
    # 訪問先のスタック
    stack = [root]
    # 訪問先が無くなるまで
    while stack:
        # 訪問者をポップアップ
        n = stack.pop()
        # 訪問者を訪問済み
        visited[n] = True
        # 訪問者のグループの親を設定
        parent[n] = root

        # root のフレンドをグループと訪問先に追加
        D[root].add(to)
        stack.append(to)

ans = [0] * N
for iam in range(N):
    # 自分の交友関係グループを設定
    group = D[parent[iam]]
    # グループからフレンドと自分を除く
    tmp_ans = len(group) - len(F[iam]) - 1
    # グループからブロックを除く
    for block in B[iam]:
        if block in group:
            tmp_ans -= 1
    ans[iam] = tmp_ans

print(*ans, sep=' ')

### FIXED CODE ###

from collections import deque

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

cango = [[]for i in range(n)]
cannotgo=[[]for i in range(n)]
for i in range(m):
    a,b = (map(int,input().split()))
    a,b = a-1,b-1
    cango[a].append(b)
    cango[b].append(a)

for i in range(k):
    c,d =(map(int,input().split()))
    c,d = c-1,d-1
    cannotgo[c].append(d)
    cannotgo[d].append(c)
# print(a)
# cango = [[]for i in range(n)]
# for i in a:
#     cango[i[0]-1].append(i[1]-1)
#     cango[i[1]-1].append(i[0]-1)
# print(cango)

# cannotgo=[[]for i in range(n)]
# for i in c:
#     cannotgo[i[0]-1].append(i[1]-1)
#     cannotgo[i[1]-1].append(i[0]-1)
# # print(cannotgo)
alre = [False]*n
parent = [-1]*n
gro = {}
y = deque()
# print(gro)
for i in range(n):
    # if alre[i]==True:
    #     continue
    # gro[i]=set([i])
    y.append(i)
    leader = i
    cnt = 0 
    while len(y)>0:
        x = y.popleft()
        if parent[x]!=-1:
            continue
            # print(to)
        parent[x]=leader
        y.extend(cango[x])
        cnt +=1
    if cnt!=0:
        gro[leader]=cnt
# print(gro)
# print(parent)
ans = [0]*n
# print(ans)
for iam in range(n):
    # group = gro[parent[iam]]
    tmp_ans = gro[parent[iam]]
    tmp_ans -=1
    tmp_ans -= len(cango[iam])
    for block in cannotgo[iam]:
        if parent[block]==parent[iam] :
            tmp_ans -=1
    ans[iam]=tmp_ans
print(*ans, sep=' ')
def comb_mod(n,m,mod):
  p = q = 1
  for i in range(m):
    p = p*(n-i) % mod
    q = q*(i+1) % mod
  return p* pow(q,mod-2,mod) % mod

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

print( (pow(2,n,mod)-1 -comb_mod(n,a,mod) -comb_mod(n,b,mod) ) % mod )

### FIXED CODE ###

def comb_mod(n,m,mod):
  p = q = 1
  for i in range(m):
    p = p*(n-i) % mod
    q = q*(i+1) % mod
  return p* pow(q,mod-2,mod) % mod

n,a,b = map(int,input().split())
mod = 10**9 +7
print( (pow(2,n,mod)-1 -comb_mod(n,a,mod) -comb_mod(n,b,mod) ) % mod )
from time import time
from math import exp
key = 1
rnd_mod = 12345678901234567891
rnd_x = 9876543210987654321 + 1234567890123456789 * key % rnd_mod
def rnd():
    global rnd_x
    rnd_x = rnd_x**2 % rnd_mod
    return (rnd_x>>10) % (1<<40)
def randrange(a, b=-1):
    if b > 0: return randrange(b-a) + a
    return rnd() % a

def calc():
    s = 0
    last = [-1] * 26
    for i, t in enumerate(A):
        s += S[i][t]
        last[t] = i
        for j, c in enumerate(C):
            s -= c * (i - last[j])
    return s

sTime = time()
D = int(input())
C = [int(a) for a in input().split()]
S = [[int(a) for a in input().split()] for _ in range(D)]
A = [randrange(26) for _ in range(D)]
# A = [0] * D
# A = [0, 16, 12, 13, 12]
# A = [0, 16, 12, 13, 19]
ans = calc()
# print("ans =", ans)
while time() - sTime < 1.8:
    T = 1000 * max(1 - (time() - sTime) / 1.5, 0)
    d = randrange(D)
    i = A[d]
    for k in range(d)[::-1]:
        if A[k] == i:
            prev = k
            break
    else:
        prev = -1
    for k in range(d + 1, D):
        if A[k] == i:
            prev_ne = k
            break
    else:
        prev_ne = D
    for j in range(26):
        t = S[d][j] - S[d][i]
        for k in range(d)[::-1]:
            if A[k] == j:
                new = k
                break
        else:
            new = -1
        for k in range(d + 1, D):
            if A[k] == j:
                new_ne = k
                break
        else:
            new_ne = D
        t += C[j] * (d - new) * (new_ne - d) - C[i] * (d - prev) * (prev_ne - d)
        if (T < 1 and t > 0) or (T >= 1 and randrange(1 << 10) < exp(t / T) * (1 << 10)):
            A[d] = j
            ans += t
            prev, prev_ne = new, new_ne
            i = j
            if 0:
                print("A =", A)
                print("ans =", ans)
                print("calc =", calc())
            
            

print(*[a + 1 for a in A], sep = "\n")
if 0:
    print(ans)
    print("A =", A)

### FIXED CODE ###

D = int(input())
for _ in range(D):
    print(1)
x = int(input())
print(max([max([i**j for j in range(2,x) if x >= i**j]) for i in range(2,x) if i**2 <=x]))

### FIXED CODE ###

a,b,c,d = map(int,input().split())
print( "Yes" if (abs(b-a) <=d and abs(c-b) <=d) or abs(c-a) <=d else "No")
s = input()
for i in range(len(s)):
  if s[i] == s[i+1]:
    print("Bad")
  else:
    print("Good")

### FIXED CODE ###

s = input()
res = "Good"
for i in range(3):
  if s[i] == s[i+1]:
    res = "Bad"
print(res)
import collections as c
 
d=c.defaultdict(list)
n=int(input())
for s in range(n-1):
    a,b,c=map(int,input().split())
    d[a].append([b,c])
    d[b].append([a,c])
 
def DFS(point,d,cost,TFlist): #入力と同じindex系
    for s in d[point]:
        try:
            p=s[0]
            c=s[1]+cost[point]
            if TFlist[p-1]:
                continue
            cost[p]+=c
            TFlist[p-1]=1
            DFS(p,d,cost,TFlist)
        except IndexError:
            continue
 
cost=[None]+[0 for i in range(n)]
q,k=map(int,input().split())
TFlist=[0 for i in range(n)]
TFlist[k-1]=1
DFS(k,d,cost,TFlist)
 
for t in range(q):
    a,b=map(int,input().split())
    print(cost[a]+cost[b])

### FIXED CODE ###

from collections import *
from heapq import*
import sys
input=lambda:sys.stdin.readline()

d=defaultdict(list)
n=int(input())

for s in range(n-1):
    a,b,c=map(int,input().split())
    d[a].append([b,c])
    d[b].append([a,c])
#defaultdict(<class 'list'>, {1: [[2, 1], [3, 1]], 2: [[1, 1], [3, 3]], 3: [[1, 1], [2, 3]]})

def DIJKSTRA(point,d):
    cost      = {node:float("inf") for node in d.keys()}
    Q         = []  #頂点のリスト
    cost[point]=0  #開始地点のコストをゼロとする（当たり前
    heappush(Q,(point,cost[point]))
    while Q:
        prefnd,tmpC=heappop(Q)
        if cost[prefnd]<tmpC:
            continue
        for node,c in d[prefnd]:
            altC=c+tmpC
            if cost[node]>altC:
                cost[node]=altC
                heappush(Q,(node,altC))
    return cost

q,k=map(int,input().split())
y=DIJKSTRA(k,d)

for i in range(q):
    a,b=map(int,input().split())
    print(y[a]+y[b])
#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

H, W = map(int,input().split())
sth, stw = map(int,input().split())
glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1

INF = -1
Gmap = [list(input()) for _ in range(H)]
seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
direc5 = set([])
for i in range(-2,3):
    for j in range(-2,3):
        direc5.add((i, j))
direc5 = direc5 - direc
direc5 = direc5 - {(0,0)}

def bfs(pnxt):
    next_q = deque([])
    for h, w in pnxt:
        next_q.append((h,w))
        seen[h][w] = 0
    nxt = set([])
    while len(next_q)!=0:
        h, w = next_q.popleft()
        print(next_q)
        if h == glh and w == glw:
            exit()
        for dh, dw in direc:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF:
                next_q.append((hs, ws))
                seen[hs][ws] = 0
        for dh, dw in direc5:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF and not (hs, ws) in nxt:
                nxt.add((hs, ws))
    return nxt

ret = 0
nxt_st = set([])
nxt_st.add((sth, stw))
while len(nxt_st)>0:
    nxt_st = bfs(nxt_st)
    ret += 1
print(-1)


### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

H, W = map(int,input().split())
sth, stw = map(int,input().split())
glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1

INF = -1
Gmap = [list(input()) for _ in range(H)]
seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
direc5 = set([])
for i in range(-2,3):
    for j in range(-2,3):
        direc5.add((i, j))
direc5 = direc5 - direc
direc5 = direc5 - {(0,0)}

def bfs(pnxt):
    next_q = deque([])
    for h, w in pnxt:
        next_q.append((h,w))
        seen[h][w] = 0
    nxt = set([])
    while len(next_q)!=0:
        h, w = next_q.popleft()
        if h == glh and w == glw:
            print(ret)
            exit()
        for dh, dw in direc:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF:
                next_q.append((hs, ws))
                seen[hs][ws] = 0
        for dh, dw in direc5:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF and not (hs, ws) in nxt:
                nxt.add((hs, ws))
    return nxt

ret = 0
nxt_st = set([])
nxt_st.add((sth, stw))
while len(nxt_st)>0:
    nxt_st = bfs(nxt_st)
    ret += 1
print(-1)
import itertools
import numpy as np

N, M = map(int, input().split())
X = [[] for _ in range(M)]
for i in range(M):
    X[i] = list(map(int, input().split()))
permutations_list = list(itertools.permutations([i for i in range(N-1)]))

count = 0
for i in range(len(permutations_list)):
    x = np.argsort(permutations_list[i])
    if [1, x[0]+2] not in X and [x[0]+2, 1] not in X:
        count += 1
        continue
    for j in range(N-2):
        pair = [x[j]+2, x[j+1]+2]
        reverse = list(reversed(pair))
        if pair not in X and reverse not in X:
            count += 1
            break
print(len(permutations_list) -count)

### FIXED CODE ###

import itertools
import numpy as np

N, M = map(int, input().split())
X = [[] for _ in range(M)]
for i in range(M):
    X[i] = list(map(int, input().split()))
permutations_list = list(itertools.permutations([i for i in range(N-1)]))

count = 0
for i in range(len(permutations_list)):
    x = np.argsort(permutations_list[i])
    if [1, x[0]+2] not in X and [x[0]+2, 1] not in X:
        count += 1
        continue
    for j in range(N-2):
        pair = [x[j]+2, x[j+1]+2]
        reverse = list(reversed(pair))
        if pair not in X and reverse not in X:
            count += 1
            break
print(len(permutations_list) -count)
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print (Even)
else:
    print(Odd)
    

### FIXED CODE ###

#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print ("Even")
else:
    print ("Odd")
def main():
    S = int(input())
    cnt = 0
    for i in range(3):
        if s[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

### FIXED CODE ###

def main():
    S = input()
    cnt = 0
    for i in range(3):
        if S[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()
N = int(input())
X =[]
LIST = ["0","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"]
B = 0
for i in range(N):
    Y =list(input())
    for i in range(10):
        
        A = LIST.index(Y[i])
        B = B + 10 ** A
    X.append(B)
    B = 0
X.sort()
#print(X)
ans = 0
count = 1 
for i in range(N-1):
    if X[i] == X[i+1]:
        count += 1
    else:
        if count != 1:
            Z = 1/2
            for i in range(1,count+1):
                Z = Z * i
            ans = ans + Z
            count = 1

if count != 1:
    Z = 1/2
    for i in range(1,count+1):
        Z = Z * i
    ans = ans + Z
        
print(int(ans))

### FIXED CODE ###

N = int(input())
X =[]
for i in range(N):
    Y =list(input())
    Y.sort()
    X.append(Y)
X.sort()
    
ans = 0
count = 1 
for i in range(N-1):
    if X[i] == X[i+1]:
        count += 1
    else:
        if count != 1:
            Z = 1
            Z = Z * count * (count-1)
            Z = Z // 2
            ans = ans + Z
            count = 1

if count != 1:
    Z = 1
    Z = Z * count * (count-1)
    Z = Z // 2
    ans = ans + Z
        
print(ans)
import heapq
import sys
N,M=map(int,input().split())
A=sorted(list(map(int,input().split())))
lst=[[0,0] for _ in range(M)]
h=[]
for i in range(M):
  lst[i]=list(map(int,input().split()))
  heapq.heappush(h,[-1*lst[i][1],lst[i][0]])
i=0
while len(h)!=0:
    v=heapq.heappop(h)
    v1,v2=-1*v[0],v[1]
    if A[i]>=v1:
      print(sum(A))
      sys.exit()
    while i<=N-1 and A[i]<v1 and v2!=0:
        A[i]=v1
        i+=1
        v2-=1
    if v2>=1:
        print(sum(A))
        sys.exit()
print(sum(A))

### FIXED CODE ###

import heapq
import sys
N,M=map(int,input().split())
A=sorted(list(map(int,input().split())))
lst=[[0,0] for _ in range(M)]
h=[]
for i in range(M):
  lst[i]=list(map(int,input().split()))
  heapq.heappush(h,[-1*lst[i][1],lst[i][0]])
i=0
while len(h)!=0:
    v=heapq.heappop(h)
    v1,v2=-1*v[0],v[1]
    while i<=N-1 and A[i]<v1 and v2!=0:
        A[i]=v1
        i+=1
        v2-=1
    if v2>=1:
        print(sum(A))
        sys.exit()
print(sum(A))
N, M = map(int, input().split())
broken_lst = []
for _ in range(M):
    broken_lst.append(int(input()))

counter_arr = [0]*(N+1)
if broken_lst[0] != 0:
    counter_arr[0] = 1
next_broken = -1
if len(broken_lst) != 0:
    next_broken = broken_lst.pop(0)
last_broken = -1

for i in range(0, N-1):
    flug = 0
    if i+1 == next_broken:
        flug = 1
#        print("p0", i, counter_arr)
    elif i+1 == last_broken:
        pass
#        print("p1",i, counter_arr)
    else:
        counter_arr[i+1] += counter_arr[i]
        counter_arr[i+1] %= 10**9 + 7
#        print("p2",i,  counter_arr)

    if i + 2 == next_broken:
        flug = 1
#        print("p3",i, counter_arr)
    else:
        counter_arr[i+2] += counter_arr[i]
        counter_arr[i+2] %= 10**9 + 7
#        print("p4",i, counter_arr)
    
    if flug == 1:
        last_broken = next_broken
        if len(broken_lst) != 0:
            next_broken = broken_lst.pop(0)

if last_broken != N - 1:
    counter_arr[-1] += counter_arr[-2]
counter_arr[-1] %= 10**9 + 7


print(counter_arr[-1])

### FIXED CODE ###

N, M = map(int, input().split())
broken_lst = []
for _ in range(M):
    broken_lst.append(int(input()))

counter_arr = [0]*(N+1)

counter_arr[0] = 1
next_broken = -1
if len(broken_lst) != 0:
    next_broken = broken_lst.pop(0)
last_broken = -1

for i in range(0, N-1):
    flug = 0
    if i+1 == next_broken:
        flug = 1
#        print("p0", i, counter_arr)
    elif i+1 == last_broken:
        pass
#        print("p1",i, counter_arr)
    else:
        counter_arr[i+1] += counter_arr[i]
        counter_arr[i+1] %= 10**9 + 7
#        print("p2",i,  counter_arr)

    if i + 2 == next_broken:
        flug = 1
#        print("p3",i, counter_arr)
    else:
        if i == 0 and len(broken_lst) != 0:
            if broken_lst[0] == 2 and next_broken == 1:
                continue
        counter_arr[i+2] += counter_arr[i]
        counter_arr[i+2] %= 10**9 + 7
#        print("p4",i, counter_arr)
    
    if flug == 1:
        last_broken = next_broken
        if len(broken_lst) != 0:
            next_broken = broken_lst.pop(0)

if last_broken != N - 1:
    counter_arr[-1] += counter_arr[-2]
counter_arr[-1] %= 10**9 + 7

print(counter_arr[-1])
from copy import deepcopy
def deal(s):
    stin=[]
    for i in range(len(s)):
        if s[i]==".":
            stin.append(0)
        else:
            stin.append(1)
    return stin
def dp(start,goal,stin):
    if goal<start or stin[goal-1]==1:
     #   print(start,goal)
      #  print(stin[goal-1])
       # print(stin)
        return False
    if start==goal:
        return True
    return dp(start,goal-1,stin) or dp(start,goal-2,stin)

n,a,b,c,d=map(int,input().split())
s=deal(input())
#print(s)
root=[]
if c<d:
    if dp(b,d,s):
        print("ceh")
        if dp(a,c,s):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif d<c:
    for i in range(b-1,d):
        if s[i]==0:
            q=deepcopy(s)
            q[i]=1
            root.append(q)
    #    print(root)
   # print("DAME")
    if dp(b,d,s):
        for x in root:
            if dp(a,c,x):
                print("Yes")
                exit()
        print("No")  
    else:
        print("aa")
        print("No")
else:
    print("No")

### FIXED CODE ###

n, a, b, c, d = map(int, input().split())
s = input()

if c < d:
    print("Yes" if s[a - 1:d].count("##") == 0 else "No")
    #aからd-1までで二個あるとあうと
else:
    print("Yes" if s[a - 1:c].count("##") ==
          0 and s[b - 2:d + 1].count("...") > 0 else "No")
          #b-1からd+1までで飛び越すの
a,b = map(int,input().split())
if(b%2!=0):
    print("No")
else:
    z = b//2 
    y = b//4
    if(a>=y and a <=z):
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

lol= [int(n) for n in input().split()]
for i in range(5):
    if(lol[i] == 0):
        print(i+1)
        break
A , op , B = input().split()
if op == "+":
	print(int(A) + int(B))
else:
	print(int(A) - int(B)

### FIXED CODE ###

A , op , B = input().split()
if op == "+":
	print(int(A) + int(B))
else:
	print(int(A) - int(B))
import math
import numpy as np

K = int(input())

dp = [[0] * 201 for _ in range(201)]
ans = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            if dp[a][b] == 0:
                dp[a][b] = math.gcd(a, b)
            if dp[dp[a][b]][c] == 0:
                dp[dp[a][b]][c] = math.gcd(dp[a][b], c)
            ans += dp[dp[a][b]][c]

print(ans)


### FIXED CODE ###

import math

K = int(input())

ans = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans += math.gcd(math.gcd(a, b), c)

print(ans)
import numpypy as np

s = input()
t = input()

dp = np.full(t , '')
# dp_len = [0]* len(t)

for i in range(len(s)):
    s_temp = s[i]
    temp_max = ''
    max_len = 0
    for j in range(len(t)):
        before = dp[j]
        if(s_temp == t[j]):
            dp[j] = temp_max + s_temp
        if(max_len < len(before)):
            temp_max = before
            max_len = len(temp_max)

ans = ''
for j in range(len(t)):
    if(len(dp[j]) > len(ans)):
        ans = dp[j]

print(ans)

### FIXED CODE ###

s = input()
t = input()

s_len = len(s)
t_len = len(t)

dp = [[0] * (t_len+1) for _ in range(s_len+1)]

for i in range(1,s_len+1):
    s_temp = s[i-1]
    for j in range(1, t_len+1):
        if(s_temp == t[j-1]):
            dp[i][j] = max(dp[i-1][j], dp[i][j-1], dp[i-1][j-1] + 1)
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

ans = ''
while(s_len > 0 and t_len > 0):
    if(dp[s_len][t_len] == dp[s_len-1][t_len]):
        s_len -= 1
    elif(dp[s_len][t_len] == dp[s_len][t_len-1]):
        t_len -= 1
    else:
        ans = s[s_len-1]  + ans
        s_len -= 1
        t_len -= 1

print(ans)
import numpy as np

N = int(input())
A = np.array(input().split()).astype(float)

res = np.sum(A == np.arange(1,N+1).reshape(N,1), axis= 1)
for i in range(N):
    print(res[i])

### FIXED CODE ###

import numpy as np

N = int(input())
A = np.array(input().split()).astype(int)

# res = np.sum(A == np.arange(1,N+1).reshape(N,1), axis= 1)
res = np.zeros(N).astype(int)
for i in range(N-1):
    res[A[i]-1] += 1
for i in range(N):
    print(res[i])
D, N = map(int, input().split())


if D==2:
    dp = [10000*i for i in range(1,10010)]
    print(dp[N-1] N!=100 else dp[N])
elif D==1:
    dp = [100*i for i in range(1,10010)]
    print(dp[N-1] N!=100 else dp[N])
else:
    print(N if N!=100 else 101)

### FIXED CODE ###

D, N = map(int, input().split())


if D==2:
    dp = [10000*i for i in range(1,10010)]
    print(dp[N-1] if N!=100 else dp[N])
elif D==1:
    dp = [100*i for i in range(1,10010)]
    print(dp[N-1] if N!=100 else dp[N])
else:
    print(N if N!=100 else 101)
x, y = map(int, input().split())

f = False
for num_of_tsuru in range(0, x+1):
    num_of_kame = x - num_of_tsuru
    if (2*num_of_tsuru) + (4*num_of_kame) == y:
        f = True
        break

if f:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

print(x.index(0)+1)
n = input()
a = inout()

print(int(n ** 2) - a)

### FIXED CODE ###

n = int(input())
a = int(input())

print(n ** 2 - a)
import sys

import numpy as np
from math import gcd

a, b = map(int, sys.stdin.readline().split())

U = gcd(a, b)

is_prime = np.zeros(10**6, dtype=bool)
is_prime[2] = True
is_prime[3::2] = True

for i in range(int(np.sqrt(U))):
    if is_prime[i]:
        is_prime[2 * i::i] = False
    
primes = is_prime.nonzero()[0]
ans = (U % primes == 0).sum()

if U != 1:
    ans += 1
print(ans)


### FIXED CODE ###

n = int(input())

if n == 1:
    print(1)
elif n % 2 == 0:
    print(0.5)
else:
    print(((n+1) / 2) / n)
from decimal import *
a, b, c = map(int, input().split())

print("Yes" if sqrt(Decimal(a)) + sqrt(Decimal(b)) < sqrt(Decimal(c)) else "No")

### FIXED CODE ###

from decimal import *
a, b, c = map(int, input().split())

print("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No")
N, K = map(int, input().split())
S = input()

dummy = ""

for i in range(N):
  if i == K-1:
    dummy += S[i].lower
  else:
    dummy += S[i]
    
print(dummy)

### FIXED CODE ###

N, K = map(int, input().split())
S = input()
 
dummy = ""
 
for i in range(N):
  if i == K-1:
    dummy += S[i].lower()
  else:
    dummy += S[i]
    
print(dummy)
a, p = mao(int, input().split())
print((a * 3 + p) // 2)

### FIXED CODE ###

a, p = map(int, input().split())
print((a * 3 + p) // 2)