Problem:


Score : 300 points

Problem Statement

A company has N members, who are assigned ID numbers 1, ..., N.

Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.

When a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.

You are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq A_i < i

Input

Input is given from Standard Input in the following format:

N
A_2 ... A_N

Output

For each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.

Sample Input 1

5
1 1 2 2

Sample Output 1

2
2
0
0
0

The member numbered 1 has two immediate subordinates: the members numbered 2 and 3.

The member numbered 2 has two immediate subordinates: the members numbered 4 and 5.

The members numbered 3, 4, and 5 do not have immediate subordinates.

Sample Input 2

10
1 1 1 1 1 1 1 1 1

Sample Output 2

9
0
0
0
0
0
0
0
0
0

Sample Input 3

7
1 2 3 4 5 6

Sample Output 3

1
1
1
1
1
1
0



Sample input:
5
1 1 2 2


Sample output:
2
2
0
0
0

Submission status: Accepted

Solution code:
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


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


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n = I()
    a_list = LI()

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

    pass


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(i) for i in input().split()]
a_dict = {}

for a in a_list:
    if a in a_dict.keys():
        a_dict[a] += 1
    else:
        a_dict[a] = 1

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#author : dokueki

import sys
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)
sys.setrecursionlimit(10**7)
mod = 1000000007


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    n = int(sys.stdin.readline())
    a = list(map(int, sys.stdin.readline().split()))
    d = dict()
    for i in range(1, n + 1):
        d[i] = 0
    for i in a:
        d[i] += 1
    for i in d.values():
        print(i)


if __name__ == "__main__":
    try:
        IOE()
    except:
        pass
    main()

Submission status: Accepted

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

number_subordinate = [0] * n

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


for number in number_subordinate:
    print(number)

Submission status: Accepted

Solution code:
# 整数 1 つ
N = int(input())

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

import collections
dic=dict(collections.Counter(A))

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

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
n = int(input())
A = list(map(int, input().split()))
dic = dd(lambda: 0)
for a in A:
    dic[a] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
l=[int(i)-1 for i in input().split()]#(n-1)
ans=[0]*n 
from collections import Counter 
c=Counter(l)
for i in range(n):
    ans[i]=c[i]
print(*ans,sep='\n')

Submission status: Accepted

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

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

for i in lista:
    listc[i-1] += 1
    
for i in listc:
    print(i)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())

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

c = Counter(As)


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

Submission status: Accepted

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

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

Submission status: Accepted

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

print("\n".join(map(str, buka)))

Submission status: Accepted

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

Submission status: Accepted

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

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

print("\n".join(map(str, results)))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

jn = [0] * N
for j in A:
    jn[j-1] += 1

for j in jn:
    print(j)

Submission status: Accepted

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

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

dict = {}
for i in a:
    if dict.get(i) is None:
        dict[i] = 1
    else:
        dict[i] += 1

#print(dict)

for i in range(1, n+1):
    if dict.get(i) is None:
        print(0)
    else:
        print(dict[i])

Submission status: Accepted

Solution code:

if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    res = [0] * (len(a) + 1)

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

    for r in res:
        print(r)

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    import collections
    count_dict = collections.Counter(A)
    for i in range(N):
        if i+1 in count_dict.keys():
            pass
        else:
            count_dict[i+1] = 0
    for i in range(N):
        print(count_dict[i+1])

# 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 math
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
"""
int(input())
map(int,input().split())
list(map(int,input().split()))
"""


            
       

t=1
for term in range(1,t+1):
    n=int(input())
    A=list(map(int,input().split()))
    d={}
    for i in range(n-1):
        if(A[i] not in d):
            d[A[i]]=0
        d[A[i]]+=1
    for i in range(1,n+1):
        if(i in d):
            print(d[i])
        else:
            print(0)

Submission status: Accepted

Solution code:
# ABC163 C

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

    res = [0] * n

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.insert(0,0)
G = {i:[] for i in range(1,N+1)}
for i in range(2,N+1):
    G[A[i]].append(i)
for i in range(1,N+1):
    print(len(G[i]))

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


N = int(input())
A = [int(x) for x in 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())
l = list(map(int, input().split()))

c = collections.Counter(l)

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
A = map(int, input().split())
counter = defaultdict(int)
for a in A:
    counter[a] += 1
for i in range(N):
    print(counter[i + 1])

Submission status: Accepted

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

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

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

for ans in cnt:
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ordinates = [0 for i in range(n)]
bosses = list(map(int, input().split()))
for boss in bosses:
	ordinates[boss-1] += 1

print("\n".join([str(item) for item in ordinates]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import numpy as np
import statistics
import string
import sys
from array import array
from collections import deque
from functools import wraps
import time

def intinput():
    return int(input())
def listintinput():
    return list(map(int, input().split()))
def splitintinput():
    return map(int, input().split())
def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)
def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True
def hcfnaive(a,b):#最大公約数 math.gcdが使えない時の手段として入れとく。pythonが更新されたらいらなくなるはず
    if(b==0):
        return a
    else:
        return hcfnaive(b,a%b)

N = intinput()
A = listintinput()

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

Submission status: Accepted

Solution code:

if __name__ == '__main__':
    b= int(input())
    a = [int(i) for i in input().split()]

    list = [0]*b

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

    for i in list:
        print(i)

Submission status: Accepted

Solution code:
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N = intinp()
A = list(mapint_inp())

l = [0]*N

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

for j in l:
    print(j)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [0] * N

for x in input().split(): A[int(x) - 1] += 1
for x in A: print(x)

Submission status: Accepted

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



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

Submission status: Accepted

Solution code:
import math
N = int(input())
lis = list(map(int,input().split()))
result = []
for i in range(N):
  result.insert(i, 0)
for zyousi in lis:
  result[zyousi-1] += 1
  
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 k in range(1,n+1):
    print(c[k])

Submission status: Accepted

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

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

Submission status: Accepted

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

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 = [int(x) for x in input().split()]
ans_li = []
d = [0] * (n)

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

for i in a:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(s) for s in input().split()]

temp_list = [0] * (n + 1)

for a in a_list:
    temp_list[a] += 1

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

Submission status: Accepted

Solution code:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(input())
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    a=list(map(int,sys.stdin.readline().split(' ')))
    ans=[0 for i in range(n)]
    for k in a:
        ans[k-1]+=1
    for k in ans:
        print(k)
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Submission status: Accepted

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

Submission status: Accepted

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

buka = [0 for _ in range(N)]
for l in lst:
    buka[l-1] += 1

for b in buka:
    print(b)

Submission status: Accepted

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

Submission status: Accepted

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

j = [0] * n

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

for i in j:
  print(i)

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int, input().split()))
c = []

for i in range(a):
  c.append(0)
for i in range(a-1):
  c[b[i]-1] += 1
for i in range(a):
  print(c[i])

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import collections

n= int(input())
a=[0]
a.extend(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 defaultdict
def main():
    n=int(input())
    aa=list(map(int,input().split()))
    d=defaultdict(int)
    for a in aa:
        d[a]+=1
    for i in range(n):
        print(d[i+1])
main()

Submission status: Accepted

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

res = [0] * N
for a in A:
  res[a-1] += 1

for i in res:
  print(i)

Submission status: Accepted

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

n = int(input())
an = list(map(int, input().split(' ')))

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

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

Submission status: Accepted

Solution code:
N =int(input())
list1 = list(map(int,input().split()))
list2 = [0]*N
for x in list1:
  list2[x-1] += 1

[print(x) for x in list2]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
As = list(map(int, input().split()))
n = defaultdict(int)
for A in As:
    n[A-1] += 1

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

Submission status: Accepted

Solution code:
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = inl()
b = [0]*(n+1)
for i in a:
    b[i] += 1
for i in range(1,n+1):
    print(b[i])

Submission status: Accepted

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

Submission status: Accepted

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

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


def solve(*args: str) -> str:
    n = int(args[0])
    A = map(int, args[1].split())
    C = Counter(A)

    return '\n'.join(str(C[i+1]) for i in range(n))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

Solution code:
import sys
#import copy
#import math
#import numpy as np
#import itertools
#import collections
#from collections import deque
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#import functools

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
#read = sys.stdin.buffer.read

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

    buka = [[] for i in range(N-1)]
    for i in range(N-1):
        buka[A[i]-1].append(i)

    for p in buka:
        print(len(p))
    print(0)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def solve(n, a_list):
    res_list = [0] * n
    for a in a_list:
        res_list[a - 1] += 1
    return res_list


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    res = solve(n, a_list)
    for r in res:
        print(r)


def test():
    assert solve(5, [1, 1, 2, 2]) == [2, 2, 0, 0, 0]
    assert solve(10, [1, 1, 1, 1, 1, 1, 1, 1, 1]) == [9, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    assert solve(7, [1, 2, 3, 4, 5, 6]) == [1, 1, 1, 1, 1, 1, 0]


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N,*A = map(int,open(0).read().split())
C = [0 for i in range(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())
joshiNum = [0 for i in range(n)]

for i in [int(i) for i in input().split()]:
    joshiNum[i-1] += 1

for i in joshiNum:
    print(i)

Submission status: Accepted

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

ans=np.zeros(n)

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

Submission status: Accepted

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

N = int(input())

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

ans = [0 for _ in range(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())
As = [int(x) for x in input().split()]
Asa = [0 for i in range(n)]
for a in As:
    Asa[a-1] += 1
for a in Asa:
    print(a)

Submission status: Accepted

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

child_cnt = [0] * n

for i, parent in enumerate(parents):
    child_cnt[parent - 1] += 1


for i, children in enumerate(child_cnt):
    print(children)

Submission status: Accepted

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

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

Submission status: Accepted

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

out = [0]*n

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from collections import Counter

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

Submission status: Accepted

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

B = [0]*N

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

Submission status: Accepted

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


N = int(input())
output = [0]*N

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

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

for o in output:
    print(o)

Submission status: Accepted

Solution code:
N=int(input())
boss=list(0 for i in range(N))
a=list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
from collections import Counter

def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    counter = Counter(A)
    for index in range(1, N+1):
        print(counter[index])

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

graph = [set() for _ in range(N + 1)]

for e, boss in enumerate(employees, 2):
  graph[boss].add(e)

for b in graph[1:]:  # 0番目は飛ばす
  print(len(b))

Submission status: Accepted

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

ans = [0]*n

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

Submission status: Accepted

Solution code:
M  =  int ( input().strip() ) ;
arr  = list (  map ( int , input().strip().split(" ") ) ) ;

arr2  = [ 0 for x in range ( M + 1 ) ] ;
for x in arr :
	arr2[x] += 1 ; 
for i in range ( 1 , len( arr2 ) )  :
	print ( arr2[i] ) ;

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0]*(n+1)
for i in s:
    ans[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()))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
A = [int(x) for x in 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())
result = [0 for i in range(n)]
lst = list(map(int, input().split()))

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

for i in result:
    print(i)

Submission status: Accepted

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

G = [0] * (N + 1)
for i, val in enumerate(A):
    G[val] += 1

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

Submission status: Accepted

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

for ai in a:
    b[ai-1] += 1
    
for bi in b:
    print(bi)

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

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

Submission status: Accepted

Solution code:

def q3():
    n = int(input())
    boss_list = [int(i) for i in input().split(" ")]

    sub_count = {}
    for boss_number in boss_list:
        if boss_number in sub_count:
            sub_count[boss_number] += 1
        else:
            sub_count[boss_number] = 1
    
    for i in range(1, n+1):
        if i in sub_count:
            print(sub_count[i])
        else:
            print(0)
        

q3()

Submission status: Accepted

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

for A in An:
  nbuka[A-1] += 1
print(*nbuka, sep="\n")

Submission status: Accepted

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

Submission status: Accepted

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

for x in range(N-2,-1,-1):
    zyousi = A[x]
    buka_num[zyousi-1] +=1
for x in range(N):
    print(buka_num[x])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

from sys import stdin
import sys
# sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]

from collections import Counter

def main():
	n=int(nextLine())
	al=nextIntList()
	
	c=Counter()
	for i,a in enumerate(al):
		c[a]+=1
	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()))

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

for j in tmp:
    print(j)

Submission status: Accepted

Solution code:
n = int(input())
c_dic = {str(x):0 for x in range(1,n+1)}

for x in input().split():
  c_dic[x] += 1

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