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=[int(n) for n in input().split()]
sub=[0]*N
for index in A:
    sub[index-1]+=1
print("\n".join(map(str,sub)))

Submission status: Accepted

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

Submission status: Accepted

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

shain = [0 for _ in range(n)]
for i in s:
    shain[i - 1] = shain[i - 1] + 1
for i in shain:
    print(i)

Submission status: Accepted

Solution code:
import numpy as np

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

B_list = np.zeros(N).astype(np.int)

for i in range(N-1):
    B_list[A_list[i]-1] += 1

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

Submission status: Accepted

Solution code:
import collections
a = int(input())
c = [int(i)-1 for i in input().split()]
b = collections.Counter(c)
for i in range(a):
  if i in b:
    print(b[i])
  else:
    print(0)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
d = {i+1: 0 for i in range(N)}
for a in A:
    d[a] += 1
for k, v in d.items():
    print(v)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = [int(i) for i in input().split()]
d = [0]*n
for i in l:
  d[i-1] += 1
for i in d:
  print(i)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(n) for n in input().split()]
sub = [0] * N
for index in A:
  sub[index-1] += 1
for num in sub:
  print(num)

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 a in ans[1:]:
    print(a)

Submission status: Accepted

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

N = int(input())
A = list(map(int, input().strip().split()))
Ans = [0] * N

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

for ans in Ans:
	print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
list1 = list(map(int,input().split()))
list2 = [0 for _ in range(n)]
for up in list1:
  list2[up-1] += 1
for num in list2:
  print(num)

Submission status: Accepted

Solution code:
N = int(input().rstrip())
l = [0 for i in range(N)]

vl = [int(i) for i in input().rstrip().split()]
for i in range(len(vl)):
    j = vl[i] - 1
    l[j] = l[j] + 1

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

Submission status: Accepted

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

d = defaultdict(int)
for i in range(1, N+1):
    d[i] = 0

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

for i in d.values():
    print(i)

Submission status: Accepted

Solution code:
b = int(input())
a = list(input().split())

result = {}
for i in range(1, b+1):
    result[i] = 0
for i in range(len(a)):
    result[int(a[i])] += 1

for i in range(1, b+1):
    print(result[i])

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
a_dict = defaultdict(int)
for i in input().split():
    a_dict[int(i)] += 1

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for i in A:
    L[i]+=1

for i in L[1:]:
    print(i)

Submission status: Accepted

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

cnt = [0] * N

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

for c in cnt:
    print(c)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num_employee = int(input())
boss_employee_ids = map(int, input().split())

boss_num_list = [0] * num_employee

for boss_employee_id in boss_employee_ids:
    boss_num_list[boss_employee_id - 1] += 1

for boss_num in boss_num_list:
    print(boss_num)

Submission status: Accepted

Solution code:
import math
import collections

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

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

    return 0

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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:])))

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()))
l =[0]*N
for i in A:
  l[i-1]+=1
print(*l,sep="\n")

Submission status: Accepted

Solution code:
from collections import Counter #リストの出現数をカウント
n = int(input())
a =Counter( list( map(int,input().split()) ) ) #同行にk個入力した数字をリスト→カウントに変換
for i in range(1,n+1) : #1~n+1未満の数字をそれぞれカウントし、改行して表示
    print(a[i])

Submission status: Accepted

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

import collections
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()))
d = [0]*N

for i in range(N-1):
  y = A[i]
  d[y-1] += 1
    
for s in range(N):
  print(d[s])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import collections


def solve(N: int, A: "List[int]"):
    c = collections.Counter(A)
    for i in range(1, N + 1):
        if i in c:
            print(c[i])
        else:
            print(0)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N - 2 + 1)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

    count = Counter(a)
    for i in range(1, n + 1):
        try:
            print(count[i])

        except IndexError:
            print(0)
resolve()

Submission status: Accepted

Solution code:
n = int(input())
 
boss_list = map(int, input().split())
 
employee_list = [0] * n
 
for boss in boss_list:
	employee_list[boss - 1] += 1
 
for employee in employee_list:
	print(employee)

Submission status: Accepted

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

for i in range(len(subordinates)):
    print(subordinates[i])

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    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)
    
    

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

b = [0]*(n+2)

for i in range(n-1):
  b[a[i]] += 1
  
for i in range(1,n+1):
  print(b[i])

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
import collections
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()))
ans = [0] * n
for i in range(len(a)):
    ans[a[i]-1] += 1
for i in range(n):
    print(ans[i])

Submission status: Accepted

Solution code:
n=int(input())
lista=input().split()
miembros=[0]*n
for elemento in lista:
    miembros[int(elemento)-1]+=1
for elemento in miembros:
    print(elemento)

Submission status: Accepted

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

managelist = [0] * n
# print(managelist) 
# manage_d = {}

for i in range(n-1):
    managelist[a[i]-1] += 1
    # print(managelist)

for i in range(n):
    print(managelist[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
alist = list(map(int, input().split(" ")))
dp = [0]*n

for i in alist:
  dp[i-1]+=1

for i in dp:
  print(int(i))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

employee_list = [0] * n

for boss in boss_list:
	employee_list[boss - 1] += 1

for employee in employee_list:
	print(employee)

Submission status: Accepted

Solution code:
n = int(input())

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

employee_list = [0] * (n)

for boss in boss_list:
	employee_list[boss - 1] += 1

for employee in employee_list:
	print(employee)

Submission status: Accepted

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

for ansi in ans:
    print(ansi)

Submission status: Accepted

Solution code:
N= int(input())
List = list(map(int, input().split()))
List.insert(0,0)
List_J = []
for i in range(N):
  List_J.append(0)
for i in range(N):
  List_J[List[i]] = List_J[List[i]] + 1
List_J.append(0)
for i in range (len(List_J)-1):
  print(List_J[i+1])

Submission status: Accepted

Solution code:
# C
import collections

inp = input()
N = int(inp)

inp = input().split(' ')
A = {i: int(inp[i-2]) for i in range(2, N+1)}
A[1] = None

buka = dict(collections.Counter(A.values()))


res = {i: buka.get(i, 0) for i in A.keys()}
for i in range(1, N+1):
    print(res[i])

Submission status: Accepted

Solution code:
n = int(input())
ans = {}

bosses = input().split(' ')

for id in range(n-1):
  if ans.get(bosses[id]) is None:
    ans[bosses[id]] = 1
  else:
    ans[bosses[id]] += 1
    
for id in range(n):
  if ans.get(str(id+1)) is None:
    print(0)
  else:
    print(ans.get(str(id+1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C - management
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 sys
n = int(sys.stdin.readline().rstrip())
li = [0 for x in range(n)]
for x in sys.stdin.readline().rstrip().split():
    li[int(x) - 1] += 1

for i in li:
    print(i)

Submission status: Accepted

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

ans = [0] * N

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

for i in range(len(ans)):
  print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
t = [0 for i in range(n)]
for i in a:
    t[i-1] += 1
for i in t:
    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 i in range(n):
    print(ans[i])

Submission status: Accepted

Solution code:
count = int(input())
num_str = input().split(' ')
nums = {}

for i in range(count):
  nums[i] = 0

for num in num_str:
  nums[int(num) - 1] += 1

for num in nums:
  print(nums[num])

Submission status: Accepted

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

answer = [0] * (N + 1)

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * n
for i in range(len(a)):
    ans[a[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()))
S = [0] * N 
for i in A:
        S[i - 1] += 1
for i in range(N):
        print(S[i])

Submission status: Accepted

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

ans=[]
[ans.append(0) for i in range(N)]

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

Submission status: Accepted

Solution code:
X= int(input())
sum = 0
Y = [0] * int(X)
Y2 = input().split()
for i in range(0, int(X)-1):
  Y[int(Y2[i])-1] +=1

for i in range(0, int(X)):
  print(str(Y[i]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
t= [0]*(n+1)
l=[int(i) for i in input().split()]
for i in l:
  t[i]+=1
for i in range(1,n+1):
  print(t[i])

Submission status: Accepted

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

sub = [0]*N

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

Submission status: Accepted

Solution code:
import collections

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

counter = [0 for _ in range(N)]

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

for i in range(len(counter)):
    print(counter[i])

Submission status: Accepted

Solution code:
N=int(input())
A_r=list(input().split())
A=[int(x) for x in A_r]
B=[0 for i in range(N)]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

count = [0] * n

for d in data:
  count[d-1] += 1

for c in count:
  print(c)

Submission status: Accepted

Solution code:
import collections

n = int(input())
data = list(map(int, input().split()))

count = [0] * n

for d in data:
  count[d-1] += 1

for c in count:
  print(c)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
A = list(map(int, input().split()))
d = dict()
for i in range(1,N+1):
    d[i] = 0

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

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

Submission status: Accepted

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

ans = [0] * N

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

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

Submission status: Accepted

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

ans = [0] * N

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

for _ in ans:
    print(_)

Submission status: Accepted

Solution code:
import math

def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    A = read_ints()
    counter = [0]*N
    for a in A:
        counter[a-1] += 1
    for c in counter:
        print(c)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N = int(input())
lis = list(map(int,input().split()))
dic = {}
for i in range(1,N+1):
    dic[i] = 0
for j in lis:
    dic[j] += 1
for k in range(1,N+1):
    print(dic[k])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

ma = [0] * N

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

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

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N=int(readline())
    A=list(map(int,readline().split()))
    res=[0]*N
    for i in range(N-1):
        res[A[i]-1]+=1
    for i in range(N):
        print(res[i])
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
M = dict([(i,0) for i in range(1,N+1)])
S = [int(x) for x in input().split()]
for s in S:
    M[s] += 1
for m in M.values():
    print(m)

Submission status: Accepted

Solution code:
N = int(input())

A = list(map(int, input().split()))  # n個の文字列がリストに格納される

ans = [0] * N

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

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

Submission status: Accepted

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

ans = [0 for _ in range(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 = list(map(int, input().split()))
buka = [0]*n
for i in range(n-1):
    buka[a[i]-1] += 1
for i in range(n):
    print(buka[i])

Submission status: Accepted

Solution code:
N=input()
A=list(input().split(" "))
count=[0]*int(N)
for a in A:
    idx=int(a)-1
    count[idx]= count[idx]+1
for c in count:
    print(c)

Submission status: Accepted

Solution code:

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

ans_l = [0]*N

i = 0
while i < N-1:
  ans_l[A_l[i]-1] += 1
  i += 1

i=0
while i < N:
  print(ans_l[i])
  i += 1

Submission status: Accepted

Solution code:
s = input()
N=int(s)
A = input().split()

buka_num = [0] * N 
#buka_num=[]
for i in range(N-1):
    #print(i)
    buka_num[int(A[i])-1] += 1
        
for i in range(N):
    print(buka_num[i])

Submission status: Accepted

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

for i in range(0,N-1):
  ans[A[i]]+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

N = int(input())

Ninzu = []
for x in input().split():
	Ninzu.append(int(x))

l = collections.Counter(Ninzu)

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

print(0)

Submission status: Accepted

Solution code:
import sys
import collections

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
c = collections.Counter(A)
for i in range(1, N + 1):
    print(c[i])

Submission status: Accepted

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

cnt = {}
for i in range(N):
    cnt.setdefault(i+1, 0)
    
for a in A:
    cnt[a] += 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()))

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

for i in mem:
    print(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(n):
  print(c.get(i+1, "0"))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

    
count = int(input())
math = list(map(int,input().split()))
lis = [0] * count

for i in range(count - 1):
    lis[math[i] - 1] += 1
    
for j in range(count):
    print(lis[j])

Submission status: Accepted

Solution 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])

Submission status: Accepted

Solution code:
#abc163 managementn
n = int(input())
ln = map(int,input().split())
output = [0]*n # output[i-1] は社員番号iの直属の部下の数　1<= i <=n
for i in ln:
    output[i-1] += 1
for  i in output:
    print(i)

Submission status: Accepted

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

for j in range(n):
    print(li[j])

Submission status: Accepted

Solution code:
N = int(input())
list = [int(x) for x in input().split()]

result = [0] * N

#print(list)

for i in range(N-1):
    #print(list[i])
    result[list[i]-1] = result[list[i]-1] + 1 

#print(result)

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

#print(list)

Submission status: Accepted

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

c = cl.Counter(a)

print(c[1])
for i, _ in enumerate(a):
  print(c[i+2])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

subordinate_list = [0 for _ in range(n)]

for i in range(len(a)):
    subordinate_list[a[i]-1] += 1

for i in range(n):
    print(subordinate_list[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:
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())
A = sorted(list(map(int, input().split())))

#for n in range(N):
#    print(A.count(n+1))

M = {}
for a in A:
    M[a] = M.get(a,0) + 1

for n in range(N):
    print(M.get(n+1,0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

B = [0] * N

for i in A:
  B[i-1] = int(B[i-1]) + 1
  
for j in B:
  print(j)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc163/tasks/abc163_c
N=int(input())
A=[0,0]
A[2:]=[int(x) for x in input().split()]
dict1={}
for i in range(2,N+1):
    tmp=str(A[i])
    if (not tmp in dict1):
        dict1[tmp]=1
    else:
        dict1[tmp]+=1
for i in range(1,N+1):
    if (str(i) in dict1):
        print(dict1[str(i)])
    else:
        print(0)

Submission status: Accepted

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

for i in A:
    ans[i-1] = int(ans[i-1]) + 1

for j in ans:
    print(j)

Submission status: Accepted

Solution code:
import sys

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


asize = len(a)
for i in range(asize):
    b[a[i]-1] += 1

for i in range(n):
    print(b[i])

Submission status: Accepted

Solution code:
N = int(input())
funcionarios = list(map(int,input().split()))
frequencia = [0 for i in range(N)]

for i in funcionarios:
    frequencia[i-1] += 1

for i in frequencia:
    print(i)

Submission status: Accepted

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

N=int(input())
A=list(map(int,input().split()))
c=collections.Counter(A)
for x in range(N):
    y=x+1
    
    print(c[y])

Submission status: Accepted

Solution code:
n = int(input())
num_list = [0] * n
for boss in input().split(' '):
    num_list[int(boss) - 1] += 1
for num in num_list:
    print(num)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
B = [0] * N
for a in input().split():
    B[int(a)-1] += 1
for b in B:
    print(b)

Submission status: Accepted

Solution code:
n = int(input())
al = map(lambda x: int(x) - 1, input().split())
a = []
count = 0
for _ in [0] * n:
    a.append(0)
for x in al:
    a[x] += 1
    count += 1
for x in a:
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

for l in L[1:]:
    print(l)

Submission status: Accepted

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

Submission status: Accepted

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

for boss in boss_list:
    l[boss-1] += 1

for ll in l:
    print(ll)

Submission status: Accepted

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

ans = [0]*N
for n in S:
    ans[n-1] += 1
for item in ans:
    print(item)

Submission status: Accepted

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

Submission status: Accepted

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


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

for c in cnt:
  print(c)

Submission status: Accepted

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
AL=[[] for _ in range(N)]
for i in range(N-1):
    AL[A[i]-1].append(i+1)
for a in AL:
    print(len(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
dict = {}
for i in map(int, input().split(" ")):
	dict[i] = dict.get(i, 0) + 1
 
for i in range(1, n + 1):
	print(dict.get(i, 0))

Submission status: Accepted

Solution code:
from collections import Counter

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

count = Counter(data)

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

Submission status: Accepted

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

for num in boss_num:
	l[num-1] += 1	
for m in l: print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


n = int(input())
A = [0]*(n+1)
for a in input().split():
    A[int(a)] +=1 

for e in A[1:]:
  print(e)