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:
#!/usr/bin/env python3

MOD = 10**9
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

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

d = {}

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

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

for k, v in d.items():
    print(v)

Submission status: Accepted

Solution code:
N = int(input())


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

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

for i in range(N-1):
    b_l[a_l[i]-1] += 1


for i in range(N):
    print(b_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:
from collections import Counter

n = int(input())
s = map(int, input().split())
c = Counter(s)
print("\n".join(map(str, (c.get(i + 1, 0) for i in range(n)))))

Submission status: Accepted

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

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

Submission status: Accepted

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

Staff_Count = [0] * (N + 1)

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

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

Submission status: Accepted

Solution code:
#import re
import sys
input = sys.stdin.readline
#import heapq
#import bisect
#from collections import deque
#import math

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
    for i in range(n):
        print(Ans[i])

    


    
if __name__ == '__main__':
    main()

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:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(lambda x: int(x) - 1, input().split()))
mng = [0 for _ in range(n)]
for i in a:
    mng[i] += 1

for i in mng:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

from collections import Counter

b = Counter(a)

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

Submission status: Accepted

Solution code:
N = int(input())
Ai = list(map(int,input().split()))
#N = 5
#Ai = [1, 1, 2, 2]
resulti = [0]*len(Ai)
for i in range(len(Ai)):
    resulti[Ai[i]-1]+=1

for i in range(len(resulti)):
    print (resulti[i])
print (0)

Submission status: Accepted

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

for i,v in enumerate(ls):
    d[v]+=1

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import Counter
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
for i,a in enumerate(A):
    ans[a-1]+=1
print(*ans,sep="\n")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
#一行で入力された数値をリストに
list=[0]*(n)

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

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

Submission status: Accepted

Solution code:
import sys, math
def input(): return sys.stdin.readline().strip()

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
dic = {}
n = int(input())
a = [int(x) for x in input().strip().split()]

for i in range(1,n+1):
    dic[i] =[]

for i in range(n-1):
    dic[a[i]].append(i+2)

res = [len(dic[i]) for i in range(1,n+1)]
for r in res:
    print(r)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字

c = Counter(nums)
ans = [0] * n
for k, v in c.items():
    ans[k - 1] = v

for a in ans:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = [0]*(n+10)
for a in A:
    s[a-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n=int(input())
l=list(map(int,input().split()))
a=[0]*n

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

Submission status: Accepted

Solution code:
# ABC163_A
n=int(input())
a=list(map(int,input().split()))
from collections import defaultdict as dd
d=dd(int)
for aa in a:
  d[aa]+=1
for i in range(n):
  print(d[i+1])

Submission status: Accepted

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

import collections
c = collections.Counter(A)

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

Submission status: Accepted

Solution code:
from collections import defaultdict

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict


num_people = int(input())
rel = list(map(int, input().split()))
d = defaultdict(int)

for r in rel:
    d[r-1] += 1

for i in range(0, num_people):
    print(d[i])

Submission status: Accepted

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

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

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

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    joushi = [0] * N
    for a in A:
        a -= 1
        joushi[a] += 1
    print("\n".join(map(str, joushi)))
    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:
import sys

n, *a = map(int, sys.stdin.read().split())
graph = [[] for _ in range(n)]
for i in range(n - 1):
    graph[a[i]-1].append(i)
def main():
    for i in range(n):
        print(len(graph[i]))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    res = [0 for _ in range(n)]
    for h in a:
        res[h-1] += 1
    for r in res:
        print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=[0 for i in range(n)]
for 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())
ans = [0] * N
A = [int(i.strip()) for i in input().split(' ')]

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

for i in ans:
    print(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:
import math

N = int(input())
# S = int(input())

# N, M = map(int, input().split())

# l = raw_input().split()
Ms = list(map(int, input().split()))

temp = [0]*N

for M in Ms:
    temp[M-1] += 1

for M in temp:
    print(M)

Submission status: Accepted

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

c_list=[0]*N
for a in a_list:
    c_list[a-1]+=1


for c in c_list:
    print(c)

Submission status: Accepted

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

freq = {}
for e in arr:
    freq[e] = freq.get(e, 0) + 1

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

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):
    if i in c.keys():
        print(c[i])
    else:
        print(0)

Submission status: Accepted

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

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

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

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

    for d in b:
        print(d)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    c = Counter(A)
    for i in range(1, N+1):
        print(c[i])
if __name__ == "__main__":
    main()

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()))
cnt = [0 for i in range(n)]

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

for c in cnt:
    print(c)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict


def main():
    n = int(input().strip())
    a_list = map(int, input().split())

    b_2_e = defaultdict(int)
    for i, a in enumerate(a_list):
        emp_i = i + 2
        b_2_e[a] += 1

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

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

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 i in range(N):
    print(S[i])

Submission status: Accepted

Solution code:
N = int(input())
An = [int(i) for i in input().split()]
nums = [0 for _ in range(N)]

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

for n in nums:
  print(n)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(e) for e in 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 sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
l = list(map(int, input().split()))
ANS = [0]*N

for i in range(N-1):
    k = l[i]
    ANS[k-1] += 1
for i in range(N):
    print(ANS[i])

Submission status: Accepted

Solution code:
def slove(n, a):
    
    count = [0]*(n+1)
    for x in a :
        count[x] +=1

    for i in count[1:]:
        print(i)
    
if __name__ == "__main__":
    n = int(input())
    a_list = [int(i) for i in input().split()]
    slove(n, a_list)

Submission status: Accepted

Solution code:
import sys
from math import pi
# import bisect
# from collections import deque

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 998244353


# for _ in range(int(ri())):
n= int(ri())
a = Ri()
dic  = {}
for i in a:
    if i in dic:
        dic[i]+=1
    else:
        dic[i] = 1

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

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())
c = Counter((int(i) for i in input().split(' ')))
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()))

buka = [0] * N
for i in A:
    buka[i-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

j=[0]*n

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

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

Submission status: Accepted

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


for i in range(1,N+1,1):
    d[i] = 0
for i in range(N-1):
    boss = A[i]
    if d[boss]!=0:
        d[boss] += 1
        continue
    d[boss] = 1


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
seq = [int(x) for x in input().split()]
ans = [0 for _ in range(n)]
for val in seq:
    ans[val-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3.8
# -*- coding: utf-8 -*-
# abc163/abc163_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    A = i2nn()
    B = [0] * N
    for a in A:
        B[a - 1] += 1
    for b in B:
        print(b)
    return

main()

Submission status: Accepted

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

from collections import Counter

a_L = Counter(a_L)

dic = {}
for i,v in a_L.items():
    dic[i] = v

for i in range(n):
    try:
        print(dic[i+1])
    except:
        print(0)

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 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 a in A:
        ans[a-1] += 1

    for a in ans:
        print(a)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans=[]
x=dict()
for i in range(N):
    x[i]=0

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

for idx in x:
    print(x[idx])

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    d = {}
    for i in range(1, n+1):
        d[i] = 0
    for b in a:
        d[b] +=1
    for k,v in d.items():
        print(v)
main()

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys 
# try:
# 	sys.stdin = open('input.txt', 'r') 
# 	sys.stdout = open('output.txt', 'w')
# except:
# 	pass
input = sys.stdin.readline
for tt in range(1):
	n = int(input())
	# a,b = map(int,input().split())
	l = list(map(int,input().split()))
	d = {}
	for i in l:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	for i in range(1,n+1):
		try:
			print(d[i])
		except:
			print(0)

Submission status: Accepted

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

Submission status: Accepted

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

ans = list([0]*n)

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

Submission status: Accepted

Solution code:
n=int(input())
a=[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:
import collections


N=int(input())
li = input().split()
c = collections.Counter(li)
for i in range(1,N+1):
    if str(i) in c.keys():
        print(c[str(i)])
    else:
        print(0)

Submission status: Accepted

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

sub = [0] * N

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

for s in sub:
  print(s)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

import collections
c = collections.Counter(A)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

from collections import Counter

c = dict(Counter(A))

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
from collections import Counter

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

Submission status: Accepted

Solution code:

# -*- coding: utf-8 -*-
N=int(input())
As=map(int, input().split())

ans=[0]*N

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

Submission status: Accepted

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import time
import math
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
sys.setrecursionlimit(10**7)
input=lambda :sys.stdin.readline().rstrip()
N=int(input())
A=list(map(int,input().split()))
A=Counter(A)
for i in range(1,N+1):
    if i in A:
        print(A[i])
    else:
        print(0)

Submission status: Accepted

Solution code:

import sys
input = sys.stdin.readline
# 自分の解答(模範解答と同じ)
def answer(N,A):
    dic={key:0 for key in range(1,N+1)}
    for a in A:
        dic[a]+=1
    for ans in dic.values():
        print(ans)



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

if __name__ == '__main__':
   main()

Submission status: Accepted

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

res = [0] * N
for a in As:
    res[a-1] += 1
for r in res:
    print(r)

Submission status: Accepted

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

# process
l = [0]*N
for a in A:
    l[a-1] += 1

# output
[print(x) for x in l]

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):
  if i in c.keys():
    print(c[i])
  else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

b = [0]*n
men = list(map(int, input().split()))

for m in men:
  b[m-1] += 1

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

Submission status: Accepted

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

    c = collections.Counter(a).most_common()
    ans = [0] * (n + 1)
    for i, cc in enumerate(c):
        ans[cc[0] - 1] += cc[1]
    for i in range(n):
        print(ans[i])
if __name__=='__main__':
    main()

Submission status: Accepted

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

sum_list = [0]*N

for a in A_list:
  sum_list[a-1]+=1

for s in sum_list:
  print(s)

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
fuck = dict()
for i in range(1, n + 1):
    fuck[i] = []

for i in range(2, n + 1):
    fuck[a[i - 2]].append(i)


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

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] += 1

for item in data:
    print(item)

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
x = [0] * n
for i in range(n-1):
    x[a[i]-1] += 1
for i in range(n):
    print(x[i])

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0] * n

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

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,operator,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
N = I()
A = LI()
count = collections.Counter(A)
for i in range(N):
    print(count[i+1])

Submission status: Accepted

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

ans = [0]*(N+1)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

employees = [0] * n
for i in a:
    employees[i - 1] += 1

for i in employees:
    print(i)

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest
from collections import Counter

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

    counter = Counter(a)

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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """5
1 1 2 2"""
        output = """2
2
0
0
0"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """10
1 1 1 1 1 1 1 1 1"""
        output = """9
0
0
0
0
0
0
0
0
0"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """7
1 2 3 4 5 6"""
        output = """1
1
1
1
1
1
0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
N = int(input())
A = list(map(int, input().split()))

A.sort()

for i in range(1,N+1):
  print(bisect_right(A,i) - bisect_left(A,i))

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


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


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


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    n = INT()
    a = LIST()
    ans = [0]*n
    for i in range(n-1):
        ans[a[i] - 1] += 1

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

n = int(input())
a = [int(x) for x 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:
def main():
    n=int(input())
    a=list(map(int,input().split()))

    from collections import Counter
    c=Counter(a)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

d = [0] * n

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())

As = np.asarray(input().split(), dtype=np.int32)

num = np.zeros(n, dtype=np.int32)

for i in range(n-1):
    num[As[i]-1] += 1

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

Submission status: Accepted

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

ans = [0] * N

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


for i in ans:
    print(i)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline                                
def I(): return list(map(int,inp().split()))

n,=I()
a=I()
ans=[0]*n
for i in a:
    ans[i-1]+=1
print('\n'.join(map(str,ans)))