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:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def main():
    n = int(input())
    a = list(map(int, input().split()))
    table = [0] * (2*10**5+5)
    for i in range(len(a)):
        table[a[i]-1] += 1

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


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

N = int(input().split()[0])
a_list = list(map(int, input().split()))
c = collections.Counter(a_list)
ans = ""
for i in range(N):
    ans += str(c[i + 1]) + "\n"
print(ans)

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
arrA = list(map(int,input().split()))
# arrA = np.array(input().split(),dtype=np.int64)

ans = [0] * (N+1)

for i in arrA:
    ans[i] += 1

ans = ans[1:]
print(*ans,sep="\n")
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
C = np.zeros(N,np.int)
for i in A:
    C[i - 1] += 1

for i in C:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k = int(input())
l = list(map(int,input().split()))
x = map(lambda x: x -1, l)
import collections
c = collections.Counter(x)
for i in range(k):
  print(c[i])

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in lst:
    print(i)

Submission status: Accepted

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

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:
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:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n = int(input())
a = list(myinput())
# print(a)

ls = [ [] for _ in range(n) ]
for i in range(n-1):
    b = a[i] - 1
    ls[b].append(i)
# print(ls)

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

Submission status: Accepted

Solution code:
# C - management

import collections

n = int(input())
A = list(int(x) for x in 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()))
ans = []
dic = {}
for i in range(len(A)):
  dic[A[i]] = dic.get(A[i])+1 if dic.get(A[i])!=None else 1
for i in range(1,n+1):
  p = dic.get(i)
  print(p if p != None else 0)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
cnt = [0 for y in range(N)]

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

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

Submission status: Accepted

Solution code:
N = int(input())
L = [int(s) for s in input().rstrip().split(' ')]
L_0 = [0 for i in range(N)]
for x in L:
    L_0[x-1] += 1
for y in L_0:
    print(y)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
import collections
n = int(input())
lis = input().split()
#n = 2*(10**5)
#lis= [1]*n

li = collections.Counter(lis)
for i in range(n):
    #print(li.count(str(i+1)))
    print(li[str(i+1)])

Submission status: Accepted

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

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

for j in ans:
    print(j)

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:
import sys
input = sys.stdin.readline
def main():
    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 BUKA:
        print(i)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N = int(input())
dic = {}
for i in range(N):
    dic[i] = 0
for a in list(map(lambda x: int(x)-1, input().split())):
    dic[a] += 1
for i in range(N):
    if dic.get(i):
        print(dic.get(i))
    else:
        print(0)

Submission status: Accepted

Solution code:
n = int(input())

A = list(map(int, input().split()))
counter = [0] * n

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

for j in counter:
    print(j)

Submission status: Accepted

Solution code:
N = int(input())
As = [int(s) for s in input().split()]

T = [0 for c in range(N+1)]

for v in As:
    T[v] += 1

for v in T[1:]:
    print(v)

Submission status: Accepted

Solution code:
def mgmt(n,al):
    b = [0 for i in range(n)]
    for a in al:
        b[a-1] += 1
    [print(i) for i in b]

n = int(input())
al = [int(i) for i in input().split()]

mgmt(n, al)

Submission status: Accepted

Solution code:
import collections
a=int(input())
b = list(map(int,input().split()))
c = collections.Counter(b)
for i in range(1,a+1):
    print(c[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()))

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

Submission status: Accepted

Solution code:
# 整数を一つ入力
N = int(input())

# スペース区切りの整数をリストに入力
A = [int(x) for x in input().split()]

E = [0]*N

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

for i in E:
    print(i)

Submission status: Accepted

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

for v in t:
    v-=1
    ans[v] += 1

for v in ans:
    print(v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict as d

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

t = d(list)
for i in range(n - 1):
	t[arr[i]].append(i+1)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

b = [0]*N
for i_a in A:
    b[i_a-1] += 1

for i_b in b:
    print(i_b)

Submission status: Accepted

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

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

for i in lm:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

keys = [0]*N
for i in range(N):
    keys[i] = i+1


num = {key:0 for key in keys}
for i in A:
    num[i] += 1

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

Submission status: Accepted

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

l = {}
for a in A:
    if a in l:
        l[a] += 1
    else:
        l[a] = 1

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

Submission status: Accepted

Solution code:
#C
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
m = max(a)
a = Counter(a)
# print(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
A = list(map(int, input().split()))
#print(N)
#print(S,T)
#print(A)
ans = [0,]*N
for a in A:
    ans[a-1] += 1
for b in ans:
    print(b)

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

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(1,n+1):
    print(d[i])

Submission status: Accepted

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

memo=[0]*(N+1)

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

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

Submission status: Accepted

Solution code:
from collections import  deque
import sys
import bisect
import math
import itertools
from queue import deque
from math import gcd

INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

def lcm(x, y): return (x * y) // gcd(x, y)


N = inp()
A = [0] + inp_list()

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

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())

count = Counter(map(int, input().split()))

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

Submission status: Accepted

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

res = [0]*N

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

for i in res:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())

a = [int(x)-1 for x in input().split()]

from collections import defaultdict

d = defaultdict(int)


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

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

Submission status: Accepted

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

for a in A:
  L[a - 1] += 1
for l in L:
  print(l)

Submission status: Accepted

Solution code:
from collections import Counter

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

cnt = Counter(A)

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

Submission status: Accepted

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

c = Counter()
for i in a:
    c[i] += 1


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Code for C - management
# Use input() to fetch data from STDIN
from collections import defaultdict

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

d = defaultdict(int)
for x in a:
    d[x] += 1

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

Submission status: Accepted

Solution code:
from collections import Counter
def solve():

    N = int(input())
    A = list(map(int,input().split()))
    cnter = Counter(A)
    for shain_id in range(1,N+1):
        print(cnter[shain_id])

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

li = [0] * n

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

for i in li:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
if __name__ == "__main__":
    # 入力パターン．
    # 先に要素数Nが与えられて，その数読み込むパターン
    ### N
    ### a_1 a_2 a_3 ... a_N
    N = int(input())
    # int型のリスト
    line = np.array(list(map(int, input().rstrip().split(' '))))
    ans = np.zeros(N)
    for l in line:
        ans[l-1] += 1
    for a in ans:
        print(int(a))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = [i for i in map(int,input().split())]
ans = dict()
for i in range(1,N+1):
    ans[i] = 0
for el in L:
    if el in ans:
        ans[el] += 1
for i in range(1,N+1):
    print(ans[i])

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    man = [0] * N

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

    for i in man:
        print(i)
    

    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())
A = list(map(int,input().split()))
listA = [0 for i in range(N)]

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

for i in range(N):
    print(listA[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:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(map(int, readline().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:
from collections import Counter
n,*a = map(int,open(0).read().split())
c = Counter(a)
for i in range(n):
  print(c[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

for b in buka:
    print(b)

Submission status: Accepted

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

b = [0] * n

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

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

Submission status: Accepted

Solution code:
import math

n = int(input())
aL = list(map(int, input().split(" ")))

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

for i in range(1, n - 1):
    cnt[aL[i] - 1] += 1

for c in cnt:
    print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

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

counter = Counter(a)

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

Submission status: Accepted

Solution code:
import sys

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

mydict = {}

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

score= [0]*(x+2)

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

for i in range(0,x-1):
    score[line[i]] = score[line[i]] + 1


for i in range(1, x+1):
    print(score[i])

Submission status: Accepted

Solution code:
#H,W = map(int,input().split())
N=int(input())
A = list(map(int,input().split()))
#S=str(input())
c=[0]*N
for i in A:
    c[i-1]+=1
for k in c:
    print(k)

Submission status: Accepted

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

Submission status: Accepted

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

i=0
B=[0]*N
while i<len(A):
    B[A[i]-1]+=1
    i+=1

for i in B:
    print(i)

Submission status: Accepted

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

l = Counter(A)

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

Submission status: Accepted

Solution code:
import sys
N=int(sys.stdin.readline().strip())
A=map(int, sys.stdin.readline().split())
L=[ 0 for _ in range(N) ]
for a in A:
    L[a-1]+=1
for x in L:
    print x

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
ans = map(str,ans)
print("\n".join(ans))

Submission status: Accepted

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

worker = [0] * N

#N-1
for i in range(len(A)):
    worker[A[i] - 1] += 1

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

Submission status: Accepted

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

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

for s in score:
    print(s)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()
A = i_l()

h = {}

for i in range(len(A)):
    h[i] = 0


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

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

print(0)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

boss = [0] * N

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

for b in boss:
    print(b)

Submission status: Accepted

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

lis = {i:0 for i in range(1,N+1)}
for a in A:
	lis[a]+=1

for l in lis.values():
	print(l)

Submission status: Accepted

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

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

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

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())
al=list(map(int, input().split()))
b=[0]*n

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
d = defaultdict(int)

N = int(input())

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

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
N = int(input())
A = [int(i) for i in readline().split()]

from collections import Counter
c = Counter(A)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

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

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



if __name__ == '__main__':
    main()

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.get(i, 0))

Submission status: Accepted

Solution code:
import collections

n = int(input())
a = [i for i in input().split()]
c = collections.Counter(a)
for i in range(1,n+1):
    print(c[str(i)])

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    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__':
    resolve()

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:
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

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

for b in B:
    print(b)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin
import math
import fractions

n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]

count = [0] * n

for aa in a:
    count[aa-1] += 1


for c in count:
    print(c)

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 = list(map(int, input().split()))

s = [0] * n

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
a = li()

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=input().split(" ")
n=np.zeros(N)

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

Submission status: Accepted

Solution code:
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
d={i+1:0 for i in range(N)}
d.update(Counter(A))
k=sorted(d.keys())
for i in k:
    print(d[i])

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

shain=[None]


class Worker:
    def __init__(self):
        self.buka=[]



for i in range(n):
    zako=Worker()
    shain.append(zako)
    
    
for i in range(2,n+1):
    shain[a[i-2]].buka.append(i)

for i in range(1,n+1):
    print(len(shain[i].buka))

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