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:
from collections import Counter
n = int(input())
Al = list(input().split())
cdict = Counter(Al)
for i in range(n):
    print(cdict[str(i+1)])

Submission status: Accepted

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

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())
List = list(map(int,input().split()))
List2 = [0]*N
for i in range(N-1):
    List2[List[i-1]-1] += 1 
for j in List2:
    print(j)

Submission status: Accepted

Solution code:
import collections

N = int(input())
A = list(map(int,input().split()))
x = collections.Counter(A)
for i in range(1,N+1):
  print(x[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 j in range(n):
  print(c[j])

Submission status: Accepted

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

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:
import  math
a=int(input())
b=[int(i) for i in input().split()]
c=[0 for i in b]
c.append(0)
for i in range(0,len(b)):
    c[b[i]-1]+=1
for i in c:
    print(i)

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print
    from collections import defaultdict
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N = input_number()
    A = input_number_list()
    d = defaultdict(lambda: 0)
    for a in A:
        d[a]+=1
    for i in range(N):
        print(d[i+1])


if __name__ == '__main__':
    main()

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:
from collections import Counter
n = int(input())
s = input()
a_list = s.split()
dic =  Counter(a_list)
k = 1
while k <= n:
  print(dic[str(k)])
  k += 1

Submission status: Accepted

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

d = {x:0 for x in range(1, 1+N)}
for x in A:
    d[x] += 1
    
print('\n'.join(map(str,d.values())))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# # スペース区切りの整数の入力
# b, c = map(int, input().split())
# スペース区切りの整数の入力
strs = input().split()

buka_nums = []
for i in range(a):
    buka_nums.append(0)

zyousi = []
for s in strs:
    zyousi_n = int(s)
    buka_nums[zyousi_n - 1] += 1

for i in buka_nums:
    print(i)

Submission status: Accepted

Solution code:
from collections import deque
import math; floor,ceil = math.floor,math.ceil
import sys; input = lambda: sys.stdin.readline().rstrip()
aint = lambda: int(input()); ints = lambda: list(map(int, input().split()))
Yes = lambda boolean: print('Yes') if boolean else print('No')
YES = lambda boolean: print('YES') if boolean else print('NO')
is_even = lambda x: True if x%2==0 else False

def main():
    n = aint()
    a = ints();d = deque(a)
    buka = [0]*n
    for _ in range(n-1):
        buka[d.popleft()-1]+=1
    for num in buka:
        print(num)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
line = list(map(lambda x:int(x) - 1, input().split()))
ans = [0 for _ in range(n)]

for i in line:
    ans[i] += 1
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
import math
from sys import *
inp=stdin.readline

zip=zip 
def linp(x):
    return list(map(int,x.split()))
def minp(x):
    return map(int,x.split())

n=int(inp())
a=linp(inp())
dic={i:0 for i in range(n)}
for i in a:
    dic[i-1]+=1
for i in range(n):
    print(dic[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


def solve(tc):
    n = int(stdin.readline().strip())
    ai = list(map(int, stdin.readline().split()))

    adj = [[] for i in range(n)]
    for i in range(n - 1):
        adj[ai[i] - 1].append(i + 1)

    for children in adj:
        print(len(children))



LOCAL_TEST = not __debug__
if LOCAL_TEST:
    infile = __file__.split('.')[0] + "-test.in"
    stdin = open(infile, 'r')

tcs = 1
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    b = [0] * N
    for a in A:
        b[a-1] += 1
    return b


# 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]"
    print(*solve(N, A), sep='\n')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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
MAX = float('inf')


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

Submission status: Accepted

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

S = [0] * N

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


for count in S:
  print(count)

Submission status: Accepted

Solution code:
def calc(N, A):
    d = {i + 1: 0 for i in range(N)}
    for a in A:
        d[a] += 1
    return '\n'.join([str(d[k]) for k in d])


N = int(input())
A = [int(s) for s in input().split()]
print(calc(N, A))

Submission status: Accepted

Solution code:
import sys
from collections import deque
import math

input = sys.stdin.readline


def solve():
    n = int(input())
    A = map(int, input().split())
    count = [0 for _ in range(n)]
    for a in A:
        count[a-1] += 1
    return '\n'.join(map(str, count))


if __name__ == '__main__':
    answer = solve()
    print(answer)

Submission status: Accepted

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

d = defaultdict(int)
for i in A:
    d[i] += 1

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

Submission status: Accepted

Solution code:
# import module
import sys
import math
import numpy as np

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

ans = [0] * n

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

for x in ans :
    print(x)

Submission status: Accepted

Solution code:
n = int(input())
#カウント用のリスト作成
a = list()
for i in range(n):
  a.append(0)

#入力リスト
b = [int(e) for e in input().split()]

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

for i in a:
  print(i)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
List = [int(i) for i in input().split(" ")]
emp = [0]*N
Con = Counter(List)
for i in Con:
    emp[i-1] = Con[i]
    
for e in emp:
    print(e)

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 n in ans:
  print(n)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

sub = np.bincount(A, weights=None, minlength=N+1)

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

Submission status: Accepted

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

ans = [0] * n

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0]*N

for i in range(N-1):
  joushi = a[i] - 1
  ans[joushi] += 1

for i in range(N):
  print(ans[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())
target = list(map(int,input().split()))

c = collections.Counter(target)
for i in range(n):
  print(c[i+1])

Submission status: Accepted

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

for i in syain:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

count = []
for i in range(len(A)+1):
    count.append(0)
for i in range(len(A)):
    count[A[i]-1] += 1

for i in count:
    print(i)

Submission status: Accepted

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

import numpy as np
import math
B = np.zeros(N)

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

for i in range(N):
  print(math.floor(B[i]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
m=list(map(int,input().split(" ")))
dic={}
dic[1]=1
for i in range(n):
    dic[i+1]=0
for mm in m:
    dic[mm]+=1
for value in dic.values():
    print(value)

Submission status: Accepted

Solution code:
from collections import Counter

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

    [print(cntA[i]) for i in range(1, N)]
    print(0)

Submission status: Accepted

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

result = [0] * n

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

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

Submission status: Accepted

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

supervision_num_list = [0] * n

for i in a_list:
    supervision_num_list[i-1] += 1

for num in supervision_num_list:
    print(num)

Submission status: Accepted

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

sub_nums = [0] * n
for a in a_list:
    sub_nums[a - 1] += 1

print("\n".join(map(str, sub_nums)))
# for sub_num in sub_nums:
#     print(sub_num)

Submission status: Accepted

Solution code:
def management():
    N=int(input())
    static_list=list(map(int,input().split()))
    result_list=[]
    for i in range(0,N):
        result_list.append(0)
    for i in range(0,len(static_list)):
            result_list[static_list[i]-1]=result_list[static_list[i]-1]+1
    for i in range(0,N):
        print(result_list[i])


if __name__=="__main__":
    management()

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in B:
    print(i)

Submission status: Accepted

Solution code:

# coding: utf-8
DATA = """
5
1 1 2 2
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N = int(get_line().strip())

Memo = [0] * (N+1)
for i in get_line().strip().split(" "):
    i = int(i)
    Memo[i] += 1    

for i in range(1, N+1):
    print (Memo[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 j in range(N):
  print(ans[j])

Submission status: Accepted

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


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

for j in e:
    print(str(j))

Submission status: Accepted

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

Submission status: Accepted

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

ans=[0]*n

for i in range(n-1):
    ans[int(a[i])-1]+=1
    
print(*ans, sep='\n')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
ar = list(map(int,input().split(" ")))
br = [0 for i in range(a)]
for r in ar:
    br[r-1] += 1
for r in br:
    print(r)

Submission status: Accepted

Solution code:
N=int(input())
A=[int(x) for x in input().rstrip().split()]
cnt=[0 for x in range(N)]
for i in A:
  cnt[i-1]+=1


for i in cnt:
  print(i)

Submission status: Accepted

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

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

for j in ans:
    print(j)

Submission status: Accepted

Solution code:
n = int(input())
numlist = list(map(int, input().split()))
# print(numlist)
result = [0] * n
# print(result)

for i in numlist:
	result[i - 1] = result[i - 1] + 1

for j in range(len(result)):
	print(result[j])
# for i in range(1, n + 1):
#	print(numlist.count(i))

Submission status: Accepted

Solution code:
N = int(input())

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

A_dict = {}

for i in A:
  A_dict.setdefault(i,0)
  A_dict[i]+=1
  
for i in range(1,N+1):
  if i in A_dict:
    print(A_dict[i])
  else:
    print(0)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
ans = [0]*n

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	N = int(input())
	countlist = [0] * N
	queri = [int(a) for a in input().split()]
	for q in queri:
		countlist[q-1] += 1
	for v in countlist:
		print(v)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
m = dict()
for i in a:
  m[i] = m.get(i,0) + 1
for i in range(1,n+1):
  print(m.get(i,0))

Submission status: Accepted

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

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

Submission status: Accepted

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

a = [0]*N

for i in range(N-1) :
  a[A[i]-1] = a[A[i]-1]+1
 
for i in a :
  print(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:
import collections

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

c = collections.Counter(a)

a.insert(0, 0)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

line = list(map(int, input().strip().split(" ")))

ans = [0 for s in range(n)]

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

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

Submission status: Accepted

Solution code:
import collections

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

def main():
    N = int(input())
    A = list(map(int,input().split()))
    Ans = [0]*(N + 1)
    for i in range(N-1):
        a = A[i]
        Ans[a] += 1
    print(*Ans[1:],sep="\n")
    return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
ans = [0] * N
for a in map(int, input().split()):
    ans[a - 1] += 1
print(*ans, sep='\n')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# In peace, in love, in war, everything is the same

import math

deg = [0] * 200005
n=int(input())
ar = list(map(int, input().split()))

for i in range(n-1):
    deg[ar[i]] = deg[ar[i]] + 1

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

Submission status: Accepted

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

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

for a in A:
  res[a-1] += 1
  
for r in res:
  print(r)

Submission status: Accepted

Solution code:
# coding: utf-8
from collections import Counter

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

# print(Counter(a_list))
count_dict = Counter(a_list)
for i in range(1,n+1):
    print(count_dict[i])

Submission status: Accepted

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

Submission status: Accepted

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

for i in B:
    print(i)

Submission status: Accepted

Solution code:
from collections import defaultdict

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

d = defaultdict(int)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for j in l:
    print(j)

Submission status: Accepted

Solution code:
n=int(input())

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

staff = dict()
staff[1] = 0

for i, a in enumerate(Ali, 2):
    staff[i] = 0
    staff[a] += 1

for j in range(1,n+1):
    print(staff[j])

Submission status: Accepted

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

sub_nums = [0] * n
for a in a_list:
    sub_nums[a - 1] += 1

for sub_num in sub_nums:
    print(sub_num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = [0 for _ in range(N + 1)]

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

for br in range(N):
    print(T[br])

Submission status: Accepted

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

for i in N:
    ans[i-1]+=1
print(*ans)

Submission status: Accepted

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

count = [0] * (N + 1)

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

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

Submission status: Accepted

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

l = [0]*n

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

for i in l:
    print(i)

Submission status: Accepted

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

buka = [0] * (n + 1)

for t in a:
    buka[t] += 1

for t in buka[1:]:
    print(t)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for x in a:
    if x in ans.keys():
        ans[x] += 1
    else:
        ans[x]=1

for i in range(1,n+1):
    print(ans.get(i,0))

Submission status: Accepted

Solution code:
EN = input().split()
Bc = [0] * int(EN[0])

tmp = input().split()
BossN = [int(s) for s in tmp]

for i in BossN:

    Bc[i-1] = Bc[i-1] + 1

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

Submission status: Accepted

Solution code:
EN = input().split()
Bc = [0] * int(EN[0])

tmp = input().split()

for i in tmp:
    BossN = int(i)
    Bc[BossN-1] = Bc[BossN-1] + 1

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

Submission status: Accepted

Solution code:
n = int(input())

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

junior_count_list = [0] * n

for boss in boss_No_list:
  junior_count_list[boss - 1] += 1

for junior in junior_count_list:
  print(junior)

Submission status: Accepted

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

Submission status: Accepted

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

# m = 0
# t = 0

# for i in range(1, n):
#     count = A.count(i)
#     print(count)
#     m += count
#     t = i
#     if m == n - 1:
#         break
# for _ in range(t, n):
#     print(0)

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()))
num = [0 for i in range(N)]
for i in A:
    num[i-1] += 1
for l in num:
    print(l)

Submission status: Accepted

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

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
[print(i) for i in ans]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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]].append(i + 2)
    else:
        d[A[i]] = [i + 2]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def main():
    N = int(input())
    A = tuple(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])

if __name__ == '__main__':
    main()

Submission status: Accepted

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

for j in a:
  print(j)

Submission status: Accepted

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

Submission status: Accepted

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

mylist = [0] * N

for i in An:
    mylist[i-1] = mylist[i-1] + 1

for i in mylist:
    print(i)

Submission status: Accepted

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

def count(N,A,Ansbox):

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import sys
import math

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

h = {}

for i in range(1, N+1):
    h[i] = 0


for j in range(N-1):
    h[A[j]] += 1


for val in h.values():
    print(val)

Submission status: Accepted

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

for bukaninzu in bukaninzu_list:    
    print(bukaninzu)

Submission status: Accepted

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

for BossNum  in BossNumsList :
  SubNumsList[BossNum-1] += 1

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

Submission status: Accepted

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

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

for i in a:
  print(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]=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()))
ans = [0 for i in range(n)]
for i in range(n-1):
    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()))

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