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:
len = int(input())
result = [0 for _ in range(len)]
nums = map(lambda x: int(x), input().split(' '))
for num in nums:
  result[num - 1] = result[num - 1] + 1
print(' '.join([str(n) for n in result]))

Submission status: Accepted

Solution code:
import collections
n,h = int(raw_input()),collections.Counter(map(int, raw_input().split(' ')))
for u in range(1, n+1): print h[u]

Submission status: Accepted

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

for x in a:
  ary[x-1] += 1

print('\r'.join(map(str, ary)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

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

cnt = Counter(A)
for i in range(N):
  print(cnt.get(i+1, 0))

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
d = Counter(a)


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in id:
	print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
counter = np.bincount(A)
for i in range(1, N+1):
    if i < len(counter):
        print(counter[i])
    else:
        print(0)

Submission status: Accepted

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

res = [0] * n

for i in hito:
  res[i - 1] += 1
for i in res:
  print(i)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
counter = np.bincount(a)
for i in range(1, n+1):
    if i < len(counter):
        print(counter[i])
    else:
        print(0)

Submission status: Accepted

Solution code:
#! env/bin/local python3
# -*- coding:utf-8 -*-

# -- submit ----

# --- fetch input ---

inputs: list = []
while True:
    try:
        inputs.append(input().strip('\n'))
    except EOFError:
        break

# --- write code below ---
n: int = int(inputs[0])
workers: list = [int(w) for w in inputs[1].split(' ')]

w_list: dict = {n: 0 for n in range(1, n+1)}

for worker in workers:
    w_list[worker] += 1

print(*w_list.values(), sep='\n')

Submission status: Accepted

Solution code:
N = int(input())
from collections import Counter as C
l = dict(C((int(x) for x in input().split())))
for x in range(1,N+1):
    print(l.get(x,0))

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.pop()-1]+=1
for i in range(N):
    print(B[i])

Submission status: Accepted

Solution code:
N=int(input())

#A[0]→2人目の社員から
A=list(map(int, input().split()))
B=list([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()))
memo=[0]*n
for i in a:
    memo[i-1]+=1
for i in memo:
    print(i)

Submission status: Accepted

Solution code:
human_num = int(input())
jousi_num = [0 for i in range(human_num)]

nyu = list(map(int, input().split(" ")))

for k in nyu:
    jousi_num[k - 1] += 1

for ri in jousi_num:
    print(ri)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    a = list(map(int, input().split()))
    
    ans = {i:0 for i in range(1,N+1)}
    for i in a:
        ans[i] += 1
    for i in ans.values():
        print(i)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
human_num = int(input())
jousi_num = [0 for i in range(human_num)]

nyu = list(map(int, input().split(" ")))

for k in nyu:
    jousi_num[k - 1] += 1

for ri in jousi_num:
    print(ri)

Submission status: Accepted

Solution code:
import sys
def inpl(): return list(map(int, sys.stdin.readline().split()))

N = int(input())

x = inpl()
y = [0]*N
for i in range(0, N-1):
    y[x[i] - 1] += 1

for i in range(0, N):
    print(y[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
print('\n'.join(map(str,ans)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)
input = sys.stdin.readline

N = I()
up_l = LI()
under_l = [0 for i in range(N)]
for i in up_l:
    under_l[i-1] += 1
[print(i) for i in under_l]

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

Submission status: Accepted

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

for i in A_list:
    bosses[i-1] += 1
for boss in bosses:
    print(boss)

Submission status: Accepted

Solution code:
import collections

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

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

Submission status: Accepted

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

ct_a=[]
for i in range(n):
    ct_a.append(0)

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

for i in ct_a:
    print(i)

Submission status: Accepted

Solution code:
employees = int(input())
boss_array = input().split(' ') 

counter = {}
for idx in range(1, employees+1):
    counter[str(idx)] = 0;

for boss_id in boss_array:
    counter[boss_id] = counter[boss_id] + 1

for idx in range(1, employees+1):
    print(counter[str(idx)])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(n, a):
    D = {i: 0 for i in range(1, n+1)}
    for x in a:
        D[x] += 1
    for i in range(1, n+1):
        print(D[i])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
def main():
  N=int(input())
  A=list(map(int,input().split()))
  d=Counter(A)
  for i in range(1,N+1):
    if i not in d:
      print(0)
    else:
      print(d[i])
if __name__=='__main__':
  main()

Submission status: Accepted

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

res=[0]*n

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

for i in res:
    print(i)

Submission status: Accepted

Solution code:
from collections import Counter
n =int(input())
a = list(map(int, input().split()))
s = Counter(a)
ans = [0] * n
for k, v in s.items():
    ans[k - 1] = v
for i in ans:
    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()))

count = collections.Counter(a)
for n in range(n):
    print(count[n+1])#1の個数から数える

Submission status: Accepted

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

    bosses = [0]*N
    for a in As:
        bosses[a-1] = bosses[a-1] + 1
    
    print("\n".join(map(str, bosses)))

Submission status: Accepted

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

for num in arr:
    dic[num]+=1
for i in range(1, n+1):
    print(dic[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:
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]
t = Counter(a)
for i in range(1, n + 1):
    if i in t.keys():
        print(t[i])
    else:
        print(0)

Submission status: Accepted

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

for i in list(a):
    ans[i] += 1

for i in range(n+1):
    if i == 0:
        continue
    print(ans[i])

Submission status: Accepted

Solution code:
n=int(input())
#l=list(map(int,input().split()))  #inputした数値列をintにしてlistを作成 けどなぜか使えない
list = input().split(" ")
list_int = []
for i in list:
  list_int.append(int(i)) 
k = [0]*n                         #大きさnのリスト
for i in list_int:
  k[i-1] = k[i-1]+1
for j in range(n):
  print(k[j])

Submission status: Accepted

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

result = {i: 0 for i in range(n)}
for id in ids:
  result[id - 1] += 1

for num in result.values():
  print(num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for C in c:
  print(C)

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

Submission status: Accepted

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('c2.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


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


def read_str():
    return input()


def main():
    N = read_int()
    A = read_int_list()
    res = [0] * N
    for i in range(N - 1):
      j = A[i] - 1
      res[j] += 1    
    print(*res, sep='\n')


main()

Submission status: Accepted

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


for x, y in mp.items():
    print(y)

Submission status: Accepted

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

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

for i in B:
    print(i)

Submission status: Accepted

Solution code:
a=int(input())

b=list(map(int,input().split()))
c=[0]*a

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

for i in c:
   print(i)

Submission status: Accepted

Solution code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-

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

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
A = [int(i) for i in input().split()]
d = [0] * N
for i in range(N - 1):
    d[A[i] - 1] += 1
for j in d:
    print(j)

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 i in a:
  d[i] += 1
for i in d:
  print(d[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

ct = collections.Counter(s)

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

Submission status: Accepted

Solution code:
# coding: utf-8

# 14:29-14:34


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

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


main()
# print(main())

Submission status: Accepted

Solution code:
import collections


def resolve():
    n = int(input())
    woker = list(map(int, input().split()))
    woker_count = collections.Counter(woker)
    for i in range(n):
        print(woker_count[i + 1])


resolve()

Submission status: Accepted

Solution code:
N=int(input())
A=map(int,input().split())
ans={i:0 for i in range(1,N+1)}

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

for v in ans.values():
    print(v)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
s=0
for num in range(1, N+1):
  count = 0
  for i in range(s, N-1):
    if A[i] == num:
      count += 1
    else:
      break
  s+=count
  print(count)

Submission status: Accepted

Solution code:
N = int(input())
subordinate_dict = {emp_num: 0 for emp_num in range(1, N + 1)}

boss_nums = [int(boss_num) for boss_num in input().split()]

for boss_num in boss_nums:
  subordinate_dict[boss_num] += 1

for num in subordinate_dict.values():
  print(num)

Submission status: Accepted

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

ans = [0] * n

for i in range(n-1):
    jyoushi = a[i]
    ans[jyoushi-1] += 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] = c[A[i]-1] + 1
   
for j in c:
    print(j)

Submission status: Accepted

Solution code:
from collections import Counter
from operator import itemgetter
N=int(input())
As=Counter([int(i) for i in input().split()])
Aslist=As.most_common()
Aslist=sorted(Aslist,key=itemgetter(0))
for num in range(N):
    if num+1 not in As.keys():
        print(0)
    else:
        print(As[num+1])

Submission status: Accepted

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

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

for v in result:
    print(v)

Submission status: Accepted

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

for r in result:
    print(r)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
#不正解
#for i in range(1,N):
#    print(A.count(i))

ans = [0]*N #listのansにN個の0を入力
#print(ans)
for i in A:
    ans[i-1] += 1


for i in ans:
   print(i)

Submission status: Accepted

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

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

for j in data:
    print(j)

Submission status: Accepted

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

Submission status: Accepted

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

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]=B[A[i]-1]+1

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int , input().split()))
a_dict = {}
for i in range(N):
    a_dict[i+1] = 0
for i in A:
    a_dict[i] += 1
for v in a_dict.values():
    print(v)

Submission status: Accepted

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

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

for count in range(len(A)):
    Clist[A[count]-1] = Clist[A[count]-1] + 1

for count in range(0,len(A)+1):
    print(Clist[count])

Submission status: Accepted

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

L=[0]*N


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


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

Submission status: Accepted

Solution code:

a=int(input())
b=list(map(int, input().split()))
dic = {}
for i in range(len(b)):
    c = b[i] 
    if not c in dic.keys():
        dic[c] = 0
    dic[c] += 1

for j in range(1, a + 1):
    if j in dic.keys():
        print(dic[j])
    else:
        print(0)

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

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

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

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 numpy as np
N = input()
N = int(N)
A = input().split()
L = np.zeros(N)
for i in range(N-1):
    L[int(A[i])-1] += 1
for i in range(len(L)):
    print(int(L[i]))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n -1) :
    a2[a1[i]-1] += 1
for j in range(n) :
    print(a2[j])

Submission status: Accepted

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

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

for i in List:
    print(i)

Submission status: Accepted

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

import collections
list2 = collections.Counter(list)

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

Submission status: Accepted

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

    ans = {}

    for i in range(len(A)):
        if A[i] in ans:    # Confirm existence of key
            ans[A[i]] += 1
        else:
            ans[A[i]] = 1
    
    for i in range(1, N):
        if i in ans:
            # print('{}'.format(ans[A[i]]))
            print('{}'.format(ans[i]))
        else:
            print('{}'.format(0))

    print('{}'.format(0))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

# count occurences of digits (the number in A represent the boss of this member)
counts = {}
for num in A:
    if num in counts:
        counts[num] += 1
    else:
        counts[num] = 1

# print counts (number of times a member was a boss)
for n in range(1, N + 1):
    if n in counts:
        print(counts[n])
    else:
        print(0)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import Counter

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

c = Counter(a)

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

Submission status: Accepted

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

Submission status: Accepted

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


N=int(input())
A=input().split()

W=[0]*N

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

for w in W:
    print(w)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
import math

def bin1(l,r,k,t,b,val,ans):
	if(l>r):
		return ans
	else:
		mid=(l+r)//2
		v=k**mid
		if(v==val):
			return v
		elif(v>val):
			ans=mid
			return bin1(mid+1,r,k,t,b,val,ans)
		else:
			return bin1(l,mid-1,k,t,b,val,ans)
		
def bin2(l,r,k,t,b,val,ans):
	if(l>r):
		return ans
	else:
		mid=(l+r)//2
		v=t*(k**mid)+b*(mid)
		if(v==val):
			return v
		elif(v>val):
			ans=mid
			return bin2(l,mid-1,k,t,b,val,ans)
		else:
			return bin2(mid+1,r,k,t,b,val,ans)

def SieveOfEratosthenes(n): 
      
    # Create a boolean array "prime[0..n]" and initialize 
    #  all entries it as true. A value in prime[i] will 
    # finally be false if i is Not a prime, else true. 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
          
        # If prime[p] is not changed, then it is a prime 
        if (prime[p] == True): 
              
            # Update all multiples of p 
            for i in range(p * p, n+1, p): 
                prime[i] = False
        p += 1
    return prime
def bin(l,r,ll,val):
	if(l>r):
		return -1
	else:
		mid=(l+r)//2
		if(val>=ll[mid][0] and val<=ll[mid][1]):
			return mid
		elif(val<ll[mid][0]):
			return bin(l,mid-1,ll,val)
		else:
			return bin(mid+1,r,ll,val)
def deci(n):
	s=""
	while(n!=0):
		if(n%2==0):
			n=n//2
			s="0"+s
		else:
			n=n//2
			s="1"+s
	return s
def diff(s1,s2):
	if(len(s1)<len(s2)):
		v=len(s1)
		while(v!=len(s2)):
			s1="0"+s1
			v=v+1
	else:
		v=len(s2)
		while(v!=len(s1)):
			s2="0"+s2
			v=v+1
	c=0
	for i in range(len(s1)):
		if(s1[i:i+1]!=s2[i:i+1]):
			c=c+1
	return c
from sys import stdin, stdout 
if __name__ == '__main__':
	n=int(stdin.readline())
	l=list(map(int,stdin.readline().split(" ")))
	l1=[]
	for i in range(n+1):
		l1.append(0)
	for i in range(len(l)):
		l1[l[i]]=l1[l[i]]+1
	
	for i in range(1,n+1):
		stdout.write(str(l1[i])+"\n")

Submission status: Accepted

Solution code:
n = int(input().strip())
arr = [int(i) for i in input().strip().split()]
result = {i:0 for i in range(1, n + 1)}
for i, j in enumerate(arr, 2):
    result[j] += 1
    
for i in result.values():
    print(i)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = [int(s) for s in input().split(" ")]
R = [0] * (len(A) + 1)
for a in A:
	R[a - 1] += 1
for a in R:
  print(a)

Submission status: Accepted

Solution code:
n = int(input())
x = [0] * n
for i in [int(j) -1 for j in input().split()]:
    x[i] += 1
print(*x, sep='\n', end='')

Submission status: Accepted

Solution code:
N = int(input())
staff = [0 for i in range(N)]
for A in map(int,input().split(" ")):
    staff[A - 1] += 1
print('\n'.join([str(s) for s in staff]))

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
ids = list(map(int, input().split(" ")))
d = {}
for i in range(1, N+1):
    d[i] = 0
for i in range(N-1):
    ans = ids[i]
    d[ans]+=1
for i in d:
    print(d[i])

Submission status: Accepted

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

x = []
for i in range(0,n):
    x.append(0)

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

for i in x:
    print(i)

Submission status: Accepted

Solution code:

n = int(input())
a = list(map(int, input().split()))
submap = {}
for each in a:
  try:
    submap[each] += 1
  except:
    submap[each] = 1
for i in range(1, n+1):
  try:
    print(submap[i])
  except:
    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]+=1
for j in range(N):
  print(ans[j])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in ans:
    print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for v in ans:
    print(v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

N = int(input())

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

c = collections.Counter(A)

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