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 collections

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

Submission status: Accepted

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

count = []
for i in range(a):
    count.append(0)
    
for i in range(len(b)):
    n = int(b[i]) -1
    count[n] += 1

for i in range(a):
    print(count[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
for l in li:
    print(l)

Submission status: Accepted

Solution code:
n = int(input())
all = list(map(int,input().split()))
result ={}
for i in range(n):
    result[i] = 0

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

#print(result)
for i in range(n):
    print(result[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):
    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()))
b ={}

for _ in a:
  if b.get(_, "NotFound") == "NotFound" :
    b[_] = 1
  else:
    b[_] += 1

for i in range(1,n+1):
  if b.get(i, "NotFound") == "NotFound" :
    print(0)
  else:
    print(b[i])

Submission status: Accepted

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

Submission status: Accepted

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

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

for sub in subordinates:
    print(sub)

Submission status: Accepted

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

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

for num in num_sub:
    print(num)

Submission status: Accepted

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

for i in range(N):
    M.append(0)

for i in range(N-1):
    if A[i] != 0:
        M[A[i]-1]+=1
        
for i in range(N):
    print(M[i])

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import collections

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

count_a = collections.Counter(a_list)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input().rstrip())

line = input().rstrip().split(' ')
a = [0] * n

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
N=int(input())
tmp=input().split(" ")

list=[]
for i in range(N-1):
    list.append(int(tmp[i]))

answer=[0]*N

for i in range(N-1):
    answer[list[i]]+=1
answer.append(0)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())

alist = input().split(" ")

aint = []

sumlist = []

for i in range(n-1):
    aint.append(int(alist[i]))

for i in range(n):
    sumlist.append(0)

for i in aint:
    sumlist[i-1] = sumlist[i-1]+1

for i in sumlist:
    print(i)

Submission status: Accepted

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

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

Submission status: Accepted

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

def solve(N: int, A: "List[int]"):
    jo=[0]*N
    for i in range(N-1):
        jo[A[i]-1]+=1
    for i in range(N):
        print(jo[i])

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
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 collections

N = int(input())
A = list(map(int, input().split()))
A = map(lambda x: x - 1, A)
c = collections.Counter(A)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

Submission status: Accepted

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


def run():
    n = int(input())
    a = list(map(int, input().split()))[:n]
    x = [0] * (n + 1)
    for _a in a:
        x[_a] += 1
    for y in x[1:]:
        print(y)


if __name__ == '__main__':
    run()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import pi

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

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

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

    for i in d:
        print(i)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [0, 0] + [int(x) for x in input().split()]

buka = [0] * (N + 1)

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

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

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline())
li = list(map(int, sys.stdin.readline().split()))
li1 = [0]*N
for i in li:
  li1[i-1] += 1
for i in li1:
  print(i)

Submission status: Accepted

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

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

"""
for i in range(1,n+1):
    print(a.count(i))
"""

S = Counter(a)

for i in range(1,n+1):
    print(S[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 i in ans:
  print(i)

Submission status: Accepted

Solution code:
N = int(input())
menber = [0] * N
number = [int(x) for x in input().split()]

for i in range(N-1):
    menber[number[i]-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque
from collections import Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers):
    return reduce(math.gcd, numbers)

N = int(stdin.readline().rstrip())
A = list(map(int,[int(x) for x in stdin.readline().rstrip().split()]))

A_ = Counter(A)

for i in range(1,N+1):
    print(A_[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:
N = int(input())
s = input().split(" ")
d = {}
for w in s:
    if w in d.keys():
        d[w] += 1
    else:
        d[w] = 1

for n in range(N):
    if str(n + 1) in d.keys():
        print(d[str(n + 1)])
    else:
        print(0)

Submission status: Accepted

Solution code:
#C - management
import collections
N = int(input())
A =list(map(int, input().split()))
A_n = collections.Counter(A)

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
r = np.zeros(n,dtype=int)
for i in input().split():
    r[int(i) - 1] += 1
for i in r:
    print(i)

Submission status: Accepted

Solution code:
emp = int(input())
boss = list(map(int, input().split()))

lis = [0] * emp

for b in boss:
  lis[b-1] += 1

for l in lis:
  print(l)

Submission status: Accepted

Solution code:
n, *aa = map(int, open(0).read().split())

from collections import Counter
ca = Counter(aa)

for i in range(1, n+1):
    have = ca[i]
    print(have)

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = IL()

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())
a = [int(i) for i in input().split()]

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

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

for cnt in boss:
	ans = cnt
	print(ans)

Submission status: Accepted

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

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

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())
input_line2 = input()

a_list = list(map(int, input_line2.split()))

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

for i in range(len(a_list)):
    counts[a_list[i]-1] += 1

for c in counts:
    print(c)

Submission status: Accepted

Solution code:
n = int(input())
an = list(map(int ,input().split()))
res = [0]*n
for i,boss in enumerate(an):
    res[boss-1] += 1
print("\n".join(list(map(str ,res))))

Submission status: Accepted

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

print(0)

Submission status: Accepted

Solution code:
import sys
import math
n = int(input())
tmpli=list(map(int,input().split()))
li = [0]*n
for i in tmpli:
    li[i - 1] += 1
for i in li:
    print(i)

Submission status: Accepted

Solution code:
e = [0] * int(input())
v = list(map(int, input().split(" ")))

for i in v:
    e[i - 1] += 1

for i in e:
    print(i)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
c = np.zeros(n)

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

Submission status: Accepted

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

for j in li:
    li_ans[j-1]+=1

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

Submission status: Accepted

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

for bitem in b:
    print(bitem)

Submission status: Accepted

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

for i in range(n):
    dict[i+1] = 0

for i in k:
    dict[i] += 1

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

Submission status: Accepted

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

list_1 = collections.Counter(a)

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

Submission status: Accepted

Solution code:
import math


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

def solve(N, A):
    C = [0 for i in range(N)]
    for a in reversed(A):
        C[a-1] += 1
    for c in C:
        print(c)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("{}".format(outputs))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
N = int(input())
a = readints()
ans = [0]*(N+1)
for i in range(len(a)):
    ans[(a[i])] += 1
for i in range(len(ans)-1):
    print(ans[i+1])

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = []
sp = 0
c = 0
for i in range(n + 1):
    if i == 0: continue
    for j in range(sp, n - 1):
        if a[j] != i:
            break
        sp += 1
        c += 1
    ans.append(c)
    c = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

bukakosuu = [0]*N

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

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

Submission status: Accepted

Solution code:
'''二分探索'''
#import bisect
'''デック'''
#from collections import deque
'''順列,組み合わせ,累積和,直積・forネスト'''
#from itertools import permutations, combinations, accumulate, product
'''小数点以下切り捨て,小数点以下切り上げ,平方根,階乗,最大公約数'''
#from math import floor, ceil, sqrt, factorial, gcd
'''input 文字列は最後に\nを含む'''
#import sys
#input = sys.stdin.readline


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import fractions
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
A = LI()

cnt = [0] * n

sa = set(A)
csa = Counter(A)

for v in sa:
    if cnt[v-1] != 0:
        continue
    cnt[v-1] = csa[v]

for c in cnt:
  print(c)

Submission status: Accepted

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

ans = [0] * N

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

counter = np.bincount(A)
ans = counter[1:].tolist()
ans.extend([0]*(N-len(ans)))
print(*ans, sep="\n")

Submission status: Accepted

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

Submission status: Accepted

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

for k in range(N):
    print(list[k])

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-04-19 21:24:22 +0900
# LastModified: 2020-04-19 21:31:26 +0900
#


import os
import sys
from collections import Counter as ct


def main():
    n=int(input())
    a = list(map(int,input().split()))
    c = ct(a)
    
    for i in range(1,n+1):
        if i in c.keys():
            print(c[i])
            continue
        print(0)

if __name__ == "__main__":
    main()

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:
# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read

n,*a = [int(i) for i in read().split()]
res = [0]*(n+1)
for i in a:
    res[i] += 1
print(*res[1:],sep="\n")

Submission status: Accepted

Solution code:
import copy
import math
n=int(input())
x=[list() for a in range(n)]
y=list(map(int,input().split()))
for t in y:
    x[t-1].append("a")
for s in x:
    print(len(s))

Submission status: Accepted

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

Submission status: Accepted

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

dic = {}
for i in lists:
    if i in dic.keys():
        dic[i] += 1
    else:
        dic[i] = 1

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

Submission status: Accepted

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

n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
boss = [0]*n

for i,j in c.items():
    boss[i-1] += j

for i in boss:
  print(i)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

ans_dict = {}
for a in a_list:
    if not(a in ans_dict):
        ans_dict[a] = 0
    ans_dict[a] += 1

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

Submission status: Accepted

Solution code:
import collections

N = int(input())

input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

c = collections.Counter(Line)

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

Submission status: Accepted

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

# C - management
N = int(input())
A = list(map(int, input().split()))
dic = dict()

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
nums = [int(e) for e in input().split()]
ans = []
count = []
nums.sort()
for i in range(0,N):
    count.append(0)
for i in nums:
    count[i-1] += 1
for i in range(0,N):
    print(count[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from collections import Counter

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

c = Counter(data)

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import Counter

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

ct = Counter(As)

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

Submission status: Accepted

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

dic = {}
for i in A:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

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

Submission status: Accepted

Solution code:
import numpy as np

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

ans=np.zeros(N)
for A in An:
    ans[A-1] += 1

for a in ans:
    print(int(a))

Submission status: Accepted

Solution code:
import collections 

N = int(input())
A = list(map(int, input().split()))
lst = set()
c = collections.Counter(A)
cnt = 0
for i in range(1, N+1):
    if(c[i] != 0):
        print(c[i])
    else:
        print(0)

Submission status: Accepted

Solution code:
a = int(input())
i = list(map(int, input().split()))
dict = {}
for num in range(a):
  dict[num] = 0

for num2 in range(len(i)):
  dict[i[num2] - 1] += 1

for num in range(a):
  print(dict[num])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

boss_nums = input()
boss_nums = boss_nums.split()

subordinate = [0] * n

for num in boss_nums:
    num = int(num)
    subordinate[num-1] += 1


for num in range(0, n):
    print(subordinate[num])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(300000)
from collections import defaultdict

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
A = LMI()

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:
from sys import stdin,stdout

for _ in range(1):
	#n,shift,ch=stdin.readline().split()
	#days,ass=map(int,stdin.readline().split())
	n=int(stdin.readline())
	a=[0,0]+list(map(int,stdin.readline().split()));sub={}
	for i in range(2,n+1):
		sub[a[i]]=sub.get(a[i],0)+1
	for k in range(1,n+1):
		stdout.write(str(sub.get(k,0))+'\n')

Submission status: Accepted

Solution code:

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

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

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

Submission status: Accepted

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

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

d = {}
for i in a:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1 

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

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

supervisor = {}

for i in arr:
    if i in supervisor:
        supervisor[i] = supervisor[i] + 1
    else:
        supervisor.update({i:1})

for i in range(1,n+1):
    if i in supervisor:
        print(supervisor[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] += 1

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

Submission status: Accepted

Solution code:
n= int(input())
arr = list(map(int,input().split(" ")))
d=dict()
for x in range(1,n+1):
    d[x]=0
for x in arr:
    d[x]+=1
#print(d)
for ele in d:
    print(d[ele])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  A_list = list(map(int, input().split()))

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

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


if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
s = input().split()
n = int(s[0])
s = input().split()
d = [0]*n
for i in s:
    d[int(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()))
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())
boss_n = map(int, input().split())

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

for i in boss_n:
    labor_dict[i] += 1
    
for i in labor_dict:
    print(labor_dict[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 sys
import numpy as np

n=int(sys.stdin.readline())
#n,k=map(int,sys.stdin.readline().split())
a=np.array(sys.stdin.readline().split(),dtype='int64')
#a=np.array([sys.stdin.readline().split() for i in range(n)],dtype='int64')

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

Submission status: Accepted

Solution code:
import sys

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


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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
N=int(input())
*S,=map(int,input().split())
C=[0 for _ in range(N+1)]

for i in S:
  C[i]+=1

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

Submission status: Accepted

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

shain_dic = {}

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

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

for i in shain_dic:
    print(shain_dic.get(i))

Submission status: Accepted

Solution code:
import collections
N=int(input())
L=list(map(int,input().split()))
for i in range(N):
	L.append(i+1)
S=collections.Counter(L)
S=sorted(S.items())
for x,y in S:
	print(y-1)

Submission status: Accepted

Solution code:
from collections import Counter

N=int(input())
A=list(map(int,input().split()))
B=set(A)
C=Counter(A)
for i in range(1,N+1):
  if i not in B:
    print(0)
  else:
    print(C[i])

Submission status: Accepted

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