Problem:


Score : 300 points

Problem Statement

A company has N members, who are assigned ID numbers 1, ..., N.

Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.

When a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.

You are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq A_i < i

Input

Input is given from Standard Input in the following format:

N
A_2 ... A_N

Output

For each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.

Sample Input 1

5
1 1 2 2

Sample Output 1

2
2
0
0
0

The member numbered 1 has two immediate subordinates: the members numbered 2 and 3.

The member numbered 2 has two immediate subordinates: the members numbered 4 and 5.

The members numbered 3, 4, and 5 do not have immediate subordinates.

Sample Input 2

10
1 1 1 1 1 1 1 1 1

Sample Output 2

9
0
0
0
0
0
0
0
0
0

Sample Input 3

7
1 2 3 4 5 6

Sample Output 3

1
1
1
1
1
1
0



Sample input:
5
1 1 2 2


Sample output:
2
2
0
0
0

Submission status: Accepted

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

num_subordinates = [0 for _ in range(N)]
for a in A:
	num_subordinates[a-1] += 1

for n in num_subordinates:
	print(n)

Submission status: Accepted

Solution code:
n=int(input())
m=list(map(int,input().split()))

o={}
for i in range(1,n+1):
  o[i]=0
  
for p in m:
  o[p]+=1

for i in range(1,n+1):
  print(o[i])

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
ans = [0] * N
for i in a:
    ans[i - 1] += 1

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
N = int(input())
liste = list(map(int, input().split()))
 
from collections import Counter
countedList = Counter(liste)
# print(

for i in range(N):
  if i+1 in countedList:
    print(countedList[i+1])
  else:
    print('0')

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = [0] * N
    for Ai in A:
        ans[Ai - 1] += 1
    for a in ans:
        print(a)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
from typing import List, Dict


def main(N: int, A: List[int]):
    bosses: Dict[int, List[int]] = {}

    for i, boss in enumerate(A, start=2):
        if boss not in bosses:
            bosses[boss] = [i]
        else:
            bosses[boss].append(i)

    for worker in range(1, N + 1):
        if worker not in bosses:
            print(0)
        else:
            print(len(bosses[worker]))


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split())))

    main(N, A)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
L = [0 for i in range(N)]
for i in range(N-1):
  L[A[i] - 1] += 1
for i in range(N):
  print(L[i])

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
a_count = Counter(a)
for i in range(n):
    print(a_count[i+1])

Submission status: Accepted

Solution code:
n=int(input())
num_list=list(map(int,input().split()))

ans=[0]*(len(num_list)+1)

for i in num_list:
  ans[i-1]+=1
  
for i in range(len(ans)):
  print(ans[i])

Submission status: Accepted

Solution code:
N = int(input())
dic = {}
for x in range(1, N + 1):
    dic[x] = 0
for x in [int(x) for x in input().split()]:
    dic[x] += 1
for x in range(1, N + 1):
    print(dic[x])

Submission status: Accepted

Solution code:
n = int(input())
ls = list(map(int, input().split()))

ls2 =[0 for x in range(n)]
#0がn個のリストを用意する

for x in ls:
    ls2[x - 1] += 1

for x in range(n):
    print(ls2[x])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = [0]*(n+1)
for i in a:
  ans[i] += 1
for i in range(1, n+1):
  print(ans[i])

Submission status: Accepted

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

C = [0]*(N+1)
for a in A:
    C[a] += 1

for c in C[1:]:
    print(c)

Submission status: Accepted

Solution code:
import sys
import math
from collections import Counter
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")



N=II()
A=LI()
c=Counter(A)

for i in range(1,N+1):
  print(c[i])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

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

for i in range(1, N+1):
    print(cnt[i])

Submission status: Accepted

Solution code:
def abc(N, A):
    # 答えの準備
    ans = [0] * N
    
    # 繰返し足し算
    for i in range(0, N - 1):
        ans[A[i] - 1] += 1
    
    # 答え
    return(ans)


# バッチスタート
if __name__ == "__main__":
    # 標準入力処理
    # 1行目の入力を数値として扱う
    N = int(input())
    
    # 2行目の入力を数値のリストとして扱う
    A = list(map(int, input().split()))
    
    # 関数呼び出し
    f = abc(N, A)
    
    # 答えの出力
    for fi in f:
        print(fi)

Submission status: Accepted

Solution code:
import collections

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

for i in range(N):
    print(count[i+1])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
lis = [0]*N
for i in range(N-1):
    lis[A[i]-1] += 1
for i in range(N):
    print(lis[i])

Submission status: Accepted

Solution code:
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(len(a)): print(f'{a[i]}')

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]

for i in a:
    b[i - 1] += 1

for i in b:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
li = map(int, input().split())
r_li = [0 for _ in range(n)]

for l in li:
    r_li[l-1] += 1
for r in r_li:
    print(r)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=[0]*n

for i in range(n-1):
  B[A[i]-1]+=1

[print(b) for b in B]

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc163/tasks/abc163_c
# -*- coding: utf-8 -*-
N = int(input())
A = input().split()
for i in range(len(A)):
  A[i] = int(A[i])
# A.insert(0,0)
buka = [0]*N
for i in range(len(A)):
  tmp = A[i]-1
  buka[tmp] += 1
for i in range(len(buka)):
  print(buka[i])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

l = [0]*n

for i in a:
    l[i-1] += 1
l
for j in l:
    print(j)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

l = [0] * n

for i in a:
    l[i-1] += 1

for j in l:
    print(j)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
cnt = [0] * n
for i in a:
    cnt[i-1] += 1
for j in cnt:
    print(j)

Submission status: Accepted

Solution code:
n = int(input())
L = list(map(int,input().split()))
M = [0]*n
for i in range(n-1):
    M[L[i]-1] +=1
for j in range(n):
    print(M[j])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
data = [0 for i in range(N)]
for i in range(N-1):
    data[A[i]-1] += 1
for j in range(N):
    print(data[j], end = '\n')

Submission status: Accepted

Solution code:
n = int(input())
a=[0]+list(map(int,input().split()))

from collections import Counter

set_a = set(a)
c =Counter(a)
for i in range(1,n+1):
    if i in set_a:
        print(c[i])
    else:
        print(0)

Submission status: Accepted

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

t = [0] * 500000

for i in range(len(A)):
    t[A[i]-1] += 1

for i in range(N):
    print(t[i])

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
for i in range(len(a)):
  b[a[i]]+=1
for i in range(1,n+1,1):
  print(b[i])

Submission status: Accepted

Solution code:
n = int(input())
a = [-1, 1] + list(map(int, input().split()))
cnt = [0] * (n+1)

for i in range(2, n+1):
    cnt[a[i]] += 1

for i in range(1, n+1):
    print(cnt[i])

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans = [0] * N
for i in range(N-1):
  ans[A[i]-1] += 1
  
for i in range(N):
  print(ans[i])

Submission status: Accepted

Solution code:
N=int(input())
A=[int(e) for e in input().split()]
C=[]
for i in range(N):
    C.append(0)
for j in A:
    C[j-1]+=1
for k in C:
    print(k)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
dic = {}
for i in range(1, n+1):
  dic[i] = 0
for a in A:
  dic[a] += 1
for i in range(1, n+1):
  print(dic[i])

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))

a = [0 for i in range(n)]

for i in range(n-1):
    a[l[i]-1] += 1

for i in a:
    print(i)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split(' ')))

# 結果格納場所
B = [0] * N
# 部下登録
for i in range(0,N-1):
    B[A[i]-1] += 1
# 結果出力
for i in B:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
dic = {}
for i in range(1, n+1):
  dic[i] = 0
for a in A:
  dic[a] += 1
for i in range(1, n+1):
  print(dic[i])

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]

staffs = [0] * N

for a in A:
    staffs[a-1] += 1

for staff in staffs:
    print(staff)

Submission status: Accepted

Solution code:
import collections

N = int(input())
a_list = list(map(int,input().split(" ")))

boss = collections.Counter(a_list)

for i in range(1,N+1):
    print(boss[i])

Submission status: Accepted

Solution code:
n,*l=map(int,open(0).read().split());a=[0]*n
for i in l:a[i-1]+=1
print(*a)

Submission status: Accepted

Solution code:
n=int(input())
ans=[0]*n
for i in list(map(int,input().split())):ans[i-1]+=1
print(*ans)

Submission status: Accepted

Solution code:
n = int(input())

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

c = [0 for i in range(n+1) ]

for i in a:
    c[i] += 1

for i in range(1,n+1):
    print(c[i])

Submission status: Accepted

Solution code:
N = int(input())
A = map(int, input().split())
ans = [0 for _ in range(N)]

for a in A:
    ans[a-1] += 1

for a in ans:
    print(a)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
subordinates = [0 for i in range(n)]
for e in a:
    subordinates[e-1] += 1
for e in subordinates:
    print(e)

Submission status: Accepted

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

ah = {}
for i in range(len(A)):
  ah[A[i]] = ah.get(A[i], 0)
  ah[A[i]] += 1

for i in range(N):
  print(ah.get(i+1, 0))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = [0] * n
    a = [int(x) for x in input().split()]
    for i in a:
        s[i-1] += 1
    for i in s:
        print(i)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A_list = [int(e) for e in input().split()]

buka_dict = dict()

for A in A_list:
    if A not in buka_dict:
        buka_dict[A] = 0
    
    buka_dict[A] += 1

for i in range(1,N+1):
    if i in buka_dict:
        print(buka_dict[i])
    else:
        print(0)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
sub = [0] * N
for a in A: sub[a-1] += 1
for s in sub: print(s)

Submission status: Accepted

Solution code:
# C - management
def main():
    N, *A = map(int, open(0).read().split())
    cnt_subordinates = [0] * (N + 1)
    for a in A:
        cnt_subordinates[a] += 1
    print("\n".join(map(str, cnt_subordinates[1:])))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# C - management
from collections import Counter


def main():
    N, *A = map(int, open(0).read().split())
    cnt_subordinates = Counter(A)
    ans = [cnt_subordinates[i] for i in range(1, N + 1)]
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
b=[0 for i in range(N)]
for x in a:
    b[x-1]+=1
for i in range(N):
    print(b[i])

Submission status: Accepted

Solution code:
import collections

n = int(input())
alist = map(int, input().split())

thelist = collections.defaultdict(int)

for a in alist:
    thelist[a] += 1

for i in range(1, n + 1):
    print(thelist[i])

Submission status: Accepted

Solution code:
import collections
import numpy as np
N = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
for i in range(1,N+1):
  print(c[i])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
n =  [0 for i in range(N) ]
for i in A:
    n[i - 1] += 1

for j in n:
    print(j)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A_count = [0]*N

for i in A:
    A_count[i-1] += 1

for i in A_count:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = [0]*(n)
for i in a:
    ans[i-1] += 1
for j in ans:
    print(j)

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    ret = [0]*N
    for a in A:
        ret[a-1] += 1
    print(*ret, sep="\n")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

ans = [0]*(n)

for i in a:
    ans[i-1] += 1

for j in ans:
    print(j)

Submission status: Accepted

Solution code:
n = int(input())
*a,=map(int, input().split( ))
ans = [0]*(n+1)

for ai in a:
    ans[ai]+=1

for ansi in ans[1:]:
    print(ansi)

Submission status: Accepted

Solution code:
employee = int(input())
boss_number = list(map(int, input().split()))
employee_zero = [0 for i in range(employee)]


for num in boss_number :
  employee_zero[num-1] += 1

for subordinate in employee_zero:
  print(subordinate)

Submission status: Accepted

Solution code:
N = int(input())
b = list(map(int,input().split()))
c = list()

for i in range( N ):
    c.append(0)
for i in b:
    c[i - 1] += 1
#print(c)
for i in range(N):
    print(c[i])

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int, input().split()))
cnt=[0]*N

for i in range(N-1):
  cnt[A[i]-1] += 1

for j in range(N):
  print(cnt[j])

Submission status: Accepted

Solution code:
import numpy as np

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

boss=[0]*N

for x in A:
    boss[x-1] += 1
for i in boss:
    print(i)

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    a = list(map(int, input().split()))

    boss_dict = defaultdict(int)
    for i in a:
        boss_dict[i] += 1
    
    for i in range(1, N + 1):
        print(boss_dict[i])



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import Counter

N, *A = map(int, open(0).read().split())

C = Counter(A)
for i in range(1, N + 1):
    print(C[i])

Submission status: Accepted

Solution code:
N = int(input())
arr = [int(s) for s in input().split()]
F = dict()
for i in range(N-1):
    if arr[i] in F.keys():
        F[arr[i]] += 1
    else:
        F[arr[i]] = 1
for i in range(1, N+1):
    if i in F:
        print(F[i])
    else:
        print(0)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
A = list(map(int, input().split()))
a = np.zeros(N)
for p in A:
    a[p-1] += 1

for i in range(N):
    print(int(a[i]))

Submission status: Accepted

Solution code:
N=int(input())
G=[0]*N

for i in [int(x) for x in input().split()]:
  G[~-i]+=1

print(*G,sep='\n')

Submission status: Accepted

Solution code:
n = int(input())
c = input().split()
c = [int(n) for n in c]

s = dict.fromkeys([int(n) for n in range(1,n+1)], 0)

for i in c:
    s[i] = s[i] + 1

for i in range(1, n+1):
    print(s[i])

Submission status: Accepted

Solution code:
N = int(input())
A = []
B = [0 for i in range(N)]
j = 0
A = list(map(int,input().split()))
list.sort(A)
T = A[0]
for i in range(N-1):
    if A[i] != T and i != N-2:
        B[T-1] = i - j
        T = A[i]
        j = i
    elif i == N-2:
        if A[i] == T:
            B[T-1] = i - j + 1
        else:
            B[T-1] = i - j
            B[A[i]-1] = 1
for i in range(N):
    print(B[i])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    Boss = [int(a) for a in input().split()]
    count = [0]*N

    for i in range(N-1):
        count[Boss[i] - 1] += 1
    for i in range(N):
        print(count[i])
if __name__ == "__main__":
    main()

Submission status: Accepted

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

di = {}

for i in A:
    if i in di:
        di[i] += 1
    else:
        di[i] = 1

for i in range(N):
    if i+1 not in di.keys():
        print(0)
    else:
        print(di[i+1])

Submission status: Accepted

Solution code:
import collections
n = int(input())
a = collections.Counter(list(map(int, input().split())))

for i in range(n):
    print(a[i+1])

Submission status: Accepted

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

S = [0]*(N+1)

for i in range(N-1):
    if(A[i] > 0):
        S[A[i]-1] += 1

for i in range(N):
    print(S[i])

Submission status: Accepted

Solution code:
size = int(input())
li = list(map(int,input().split()))
"""ans = [0]*size
for i in li:
    if i not in ans:
        ans[i-1] = 1
    else:
        ans[i-1] += 1
for i in ans:
    print(i)
"""
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    print(i)

Submission status: Accepted

Solution code:
from sys import stdin,stdout
size = int(stdin.readline())
li = list(map(int,stdin.readline().split()))
"""ans = [0]*size
for i in li:
    if i not in ans:
        ans[i-1] = 1
    else:
        ans[i-1] += 1
for i in ans:
    print(i)
"""
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    stdout.write(str(i)+"\n")

Submission status: Accepted

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

sub_nums = [0 for i in range(N)]

for v in A:
    sub_nums[v-1] += 1

for v in sub_nums:
    print(v)

Submission status: Accepted

Solution code:
import math
N=input()
A=list(map(int, input().split()))
N=int(N)
B = [0] * N
for i in A:
	B[i-1]+=1
    
for i in B:
	print(i)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
nums = [0] * n

for i in a:
    nums[i-1] += 1

print("\n".join(map(str, nums)))

Submission status: Accepted

Solution code:
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N = int(input())
A = np.array(list(map(int, input().split())))
B = np.zeros(N+1, dtype = np.int64)

for a in A:
	B[a] += 1

for b in B[1:]:
	print(b)

Submission status: Accepted

Solution code:
n = int(input())
ans = [0]*n
a = list(map(int,input().split()))
for i in a:
    ans[i-1]+=1  
for i in range(n):
    print(ans[i])

Submission status: Accepted

Solution code:
n = int(input())
num_under = [0 for i in range(n)]
boss = [int(i) - 1 for i in input().split(" ")]
for i in boss:
    num_under[i] += 1
for i in num_under:
    print(i)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
number = list(map(int,input().split()))
number_dic = Counter(number)
for i in range(n):
    if i+1 in number_dic.keys():
        print(number_dic[i+1])
    else:
        print(0)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N-1):
  ans[A[i] - 1] += 1
for i in range(N):
  print(ans[i])

Submission status: Accepted

Solution code:
import numpy as np

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

B = np.zeros(N+1)

for a in A:
    B[a] += 1

for b in B[1:]:
    print(int(b))

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
L=[0]*n
for i in range(n-1):
    L[A[i]-1]+=1
for i in range(n):
    print(L[i])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    from collections import Counter
    import sys
    input = sys.stdin.readline

    n = int(input())
    a = Counter(map(int, input().split()))
    keys = a.keys()

    for i in range(1, n + 1):
        if i in keys:
            print(a[i])
        else:
            print(0)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
sub=[0 for i in range(n)]
for c in l:
	sub[c-1]+=1
for c in sub:
	print(c)
# print()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
re=[0]*n
for i in a:
  re[i-1]+=1
for i in re:
  print(i)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n-1):
    b[a[i]-1]+=1
for i in range(n):
    print(b[i])

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
for i in A:
  B[i]+=1
for j in range(1,N+1):
  print(B[j])

Submission status: Accepted

Solution code:
n = int(input())
l = map(int, input().split())
r = [0 for _ in range(n)]
for i in l:
  r[i-1] += 1
  
for i in r:
  print(i)

Submission status: Accepted

Solution code:
from collections import defaultdict

n = int(input())
a = [int(m) for m in input().split()]
n_buka = defaultdict(int)  # 辞書を作成，デフォルトは0
# d = defaultdict(lambda: float("INF"))

for i in range(n - 1):
    n_buka[a[i]] += 1

for i in range(1, n + 1):
    print(n_buka[i])

Submission status: Accepted

Solution code:
n = int(input())
a_list = map(int,input().split())
ans = [0]*n
for a in a_list:
    ans[a-1] += 1
    
print("\n".join(map(str,ans)))

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
for i in range(N-1):
  B[A[i]-1]+=1
for i in range(N):
  print(B[i])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
c = [0] * n
for i in range(n-1):
    c[a[i]-1] += 1
for i in range(n):
    print(c[i])

Submission status: Accepted

Solution code:
import collections

N = int(input())

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

c = collections.Counter(A)

for i in range(1, N + 1):
    print(c[i])

Submission status: Accepted

Solution code:

N = int(input())
Alist = list(map(int,input().split()))#iの上司

result = [0]*N

for i in range(N-1):#最後の社員に部下いない
    result[Alist[i]-1] +=1#上司の順番の要素に+1

for i in range(N):
    print(result[i])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in a:
    ans[i-1] += 1
for j in ans:
    print(j)

Submission status: Accepted

Solution code:
import collections
 
N = int(input())
A = list(map(int,input().split()))
a = collections.Counter(A)
 
for i in range(N):
  print(a[i+1])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
 
result = [0]*N
 
for i in range(N-1):
    result[A[i]-1] += 1
 
for i in range(N):
    print(result[i])

Submission status: Accepted

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
freq=[0]*(200020)
for i in range(len(arr)):
	freq[arr[i]]+=1
for i in range(1,n+1):
	print(freq[i])

Submission status: Accepted

Solution code:
n = int(input())
member = [0] * n
for a in map(int, input().split()):
  member[a-1] += 1
for m in member:
  print(m)

Submission status: Accepted

Solution code:
import os

def main():
	n = int(input())
	a_list = list(map(int, input().split()))
	result = [0]*n
	for i in a_list:
		result[i-1] += 1
	for i in result:
		print(i)

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
num = int(input())
boss = input().split()
ans_list = [0] * num
for i_boss in boss:
    ans_list[int(i_boss)-1] += 1
print('\n'.join(list(map(str, ans_list))))

Submission status: Accepted

Solution code:
num_sub  = int(input())
sub_boss = input().split()

num_boss = [0]*(num_sub)

for i in sub_boss:
	num_boss[int(i)-1] += 1

for i in num_boss:
	print(i)

Submission status: Accepted

Solution code:
num = int(input())
boss = input().split()

ans_list = [0] * num

for i_boss in boss:
    ans_list[int(i_boss)-1] += 1
a = list(map(lambda  x: str(x), ans_list))
print('\n'.join(a))

Submission status: Accepted

Solution code:
社員数 = int(input())
部下数 = [0] * (社員数 + 1)

for 上司 in map(int, input().split(' ')):
    部下数[上司] += 1

print('\n'.join(map(str, 部下数[1:])))

Submission status: Accepted

Solution code:
def main():
    N = int( input())
    A = list( map( int, input().split()))
    B = [0]*(N)
    for a in A:
        B[a-1] += 1
    print("\n".join( map( str, B)))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():

    num = int(input())
    boss = input().split()

    ans_list = [0] * num
    
    for i_boss in boss:
        #print(f'start for {i_boss}')
        ans_list[int(i_boss)-1] += 1
    a = list(map(lambda  x: str(x), ans_list))
    print('\n'.join(a))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N = int( input())
    A = list( map( int, input().split()))
    B = [0]*(N+1)
    for a in A:
        B[a] += 1
    print("\n".join( map( str, B[1:])))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
社員数 = int(input())
部下数 = [0] * 社員数

for 上司 in map(int, input().split(' ')):
    部下数[上司-1] += 1

print('\n'.join(map(str, 部下数)))

Submission status: Accepted

Solution code:
社員数 = int(input())
部下数 = [0] * 社員数

for 上司 in map(int, input().split()):
    部下数[上司-1] += 1

[print(_) for _ in 部下数]

Submission status: Accepted

Solution code:
import collections
N = int(input())
A = list(map(int, input().split()))

c = collections.Counter(A)

for i in range(N):
    print(c[i+1])

Submission status: Accepted

Solution code:
社員数 = int(input())
部下数 = [0] * 社員数

for 上司 in map(int, input().split()):
    部下数[上司-1] += 1

print('\n'.join([str(_) for _ in 部下数]))

Submission status: Accepted

Solution code:
num_sub  = int(input())
sub_boss = input().split()

num_boss = [0]*(num_sub)

for i in sub_boss:
	i = int(i)
	num_boss[i-1] = num_boss[i-1] + 1

for i in num_boss:
  print(i)

Submission status: Accepted

Solution code:
members_count = int(input())

belong_map = {}

belongings = [int(x) for x in input().split(' ')]

for b in belongings:
    if b - 1 in belong_map:
        belong_map[b - 1] += 1
    else:
        belong_map[b - 1] = 1

for i in range(members_count):
    if i in belong_map:
        print(belong_map[i])
    else:
        print(0)

Submission status: Accepted

Solution code:
社員数 = int(input())
部下数 = [0] * 社員数

for 上司 in map(int, input().split()):
    部下数[上司-1] += 1

print('\n'.join(map(str, 部下数)))

Submission status: Accepted

Solution code:
a = int(input())
b = [0] * a

for c in map(int, input().split()):
    b[c-1] = b[c-1] + 1

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

Submission status: Accepted

Solution code:
a = int(input())
b = [0] * a

for c in map(int, input().split()):
    b[c-1] += 1

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

Submission status: Accepted

Solution code:
社員数 = int(input())
部下数 = [0] * 社員数

for 上司 in input().split(' '):
    部下数[int(上司)-1] += 1

print('\n'.join(map(str, 部下数)))

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(i) for i in input().split()]
nl = [0] * n
for a in a_list:
    nl[a-1] += 1
for v in nl:
    print("{}".format(v))

Submission status: Accepted

Solution code:
# C
n = int(input())
a = list(map(int, input().split()))

ans = [0]*n
for i in range(n-1):
    ans[a[i]-1] += 1 
    
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
a_list = map(int, input().split())
nl = [0] * n
for a in a_list:
    nl[a-1] += 1
for v in nl:
    print("{}".format(v))

Submission status: Accepted

Solution code:
n = int(input())
a_list = map(int, input().split())
nl = {str(i):0 for i in range(n)}
for a in a_list:
    nl[str(a-1)] += 1
for v in nl.values():
    print("{}".format(v))

Submission status: Accepted

Solution code:
社員数 = int(input())
部下数 = [0] * 社員数

for 上司 in map(int, input().split(' ')):
    部下数[上司-1] += 1

[print(部下) for 部下 in 部下数]

Submission status: Accepted

Solution code:
N = int(input())
X = [0]*N
A = list(map(int,input().split()))
for i in A:
    X[i-1] +=1
print(*X,sep="\n")

Submission status: Accepted

Solution code:
社員数 = int(input())
部下数 = [0] * 社員数

for 上司 in map(int, input().split(' ')):
    部下数[上司-1] += 1

for 部下 in 部下数:
    print(部下)

Submission status: Accepted

Solution code:
num_employee = int(input())
num_subordinate = [0] * num_employee

for boss in map(int, input().split(' ')):
    num_subordinate[boss-1] += 1

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

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(i) for i in input().split()]
nl = {str(i):0 for i in range(n)}
for a in a_list:
    nl[str(a-1)] += 1
for v in nl.values():
    print("{}".format(v))

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = Counter(list(map(int,input().split())))
for i in range(1,n+1):
    print(a[i])

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
x = [0] * N

for i in A:
    x[i-1] += 1

for i in x:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(i) for i in input().split()]
nl = [0 for i in range(n)]
for a in a_list:
    nl[a-1] += 1
for i in nl:
    print("{}".format(i))

Submission status: Accepted

Solution code:
N = int(input())
l = [int(x) for x in input().split()]
ans = [0] * N
for i in range(N-1):
  ans[l[i]-1] += 1
for i in range(N):
  print(ans[i])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i in a:
    ans[i-1] += 1
for j in ans:
    print(j)