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:
N = int(input())
A = [int(s) for s in input().split()]

under = [0] * N

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

for u in under:
    print(u)

Submission status: Accepted

Solution code:
def solve(n, arr):
    d = {}
    for i in range(n):
        d[i] = (0)
    for i in arr:
        d[i-1] += 1
    for v in d.values():
        print(v)

if __name__ == "__main__":
    n = int(input())
    arr = [int(s) for s in list(input().split())]
    solve(n ,arr)

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

cnt = [0]*n

for x in data:
    cnt[x-1] += 1

for x in cnt:
    print(x)

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from typing import Callable, NoReturn, Tuple


def main() -> NoReturn:
    scan: Callable[[], str] = sys.stdin.readline

    n: int = int(scan().rstrip())
    a: Tuple[int] = tuple(int(a_i) for a_i in scan().rstrip().split())

    count: Counter = Counter(a)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    memo=[0]*(2*(10**5)+2)
    #n,m,k=map(int, readline().rstrip().split())
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    for a in arr:
        memo[a]+=1
    
    for i in range(n):
        print(memo[i+1])
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

Solution code:
from collections import defaultdict

res = defaultdict(list)
n = int(input())
for i, j in zip(range(2, 2+n), map(int, input().split())):
  res[j].append(i)
  res[i]

for k,v in res.items():
	print(len(v))

Submission status: Accepted

Solution code:
N=int(input())

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

B=[0]*(len(A)+1)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(k) for k in input().split(' ')]
res = [0 for x in range(N)]

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

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

Submission status: Accepted

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

ans = [0] * (N + 1)

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

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

Submission status: Accepted

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

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

print('\n'.join(map(str,subordinate)))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
count = [0] * N
for i, a in enumerate(A, start=2):
    count[a - 1] += 1
for c in count:
    print(c)

Submission status: Accepted

Solution code:
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):
        if C[i]:
            print(C[i])
        else:
            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:
n = int(input())
a = [int(i) for i in input().split()]
output = [0] * n
for i in a:
    output[i-1] += 1
for i in output:
    print(i)

Submission status: Accepted

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

for i in range(n-1):
    ans[an[i]-1] += 1

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

Submission status: Accepted

Solution code:
import sys

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

ans = [0] * N

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

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

Submission status: Accepted

Solution code:
N = int(input())
A_list = list(map(int, input().split()))
mydic = { x:0 for x in range(N+1)}
#print(mydic)

for a in A_list:
    #print(a)
    mydic[a] += 1 
    
for d in range(1,N+1):
    print(mydic[d])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    N=int(sys.stdin.readline())
    subo=[0]*(N+1)
    for a in map(int,sys.stdin.readline().split()):
        subo[a]+=1
    for i in range(1,N+1):
        print(subo[i])

main()

Submission status: Accepted

Solution code:
import math
import sys
import collections

def main():
    #N,M=map(int,input().split())
    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])





if __name__ == '__main__':
    main()

Submission status: Accepted

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

hoge = [0] * N

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

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

dic = {}

for num in lisA:
    if num in dic:
        dic[num] += 1
    else:
        dic[num] = 1

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

Submission status: Accepted

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

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

for c in counts:
    print(str(c))

Submission status: Accepted

Solution code:
from collections import Counter


def i1str():
    return input()


def istrs(n=None):
    if n is None:
        return input().split()
    a = []
    for _ in range(n):
        a.append(istrs())
    return a


def i1num():
    return int(input())


def inums(n=None):
    if n is None:
        return list(map(int, input().split()))
    a = []
    for _ in range(n):
        a.append(inums())
    return a


def ostrs(l, sp=" "):
    print(sp.join(l))


def onums(l, sp=" "):
    print(sp.join(map(str, l)))


def solve(n, a):
    cnt = Counter(a)
    for i in range(n):
        print(cnt[i+1])


if __name__ == "__main__":
    n = i1num()
    a = inums()
    solve(n, a)

Submission status: Accepted

Solution code:
from collections import Counter
def readInt():
    return list(map(int,input().split()))
n = int(input())
a = readInt()
ans = Counter(a)
# print(ans)
for i in range(1,n+1):
    print(ans[i])

Submission status: Accepted

Solution code:
import collections
N = int(input())     
Alist = [int(x) for x in input().split()]
c = collections.Counter(Alist)
for i in range(1,N+1):
    print(c[i])

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(*ans, sep='\n')

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b={}
for i in range(len(a)):
    if a[i] in b:
        b[a[i]]+=1
    else:
        b[a[i]]=1
c=[0]*n
for i in range(len(c)):
    if i+1 in b:
        c[i]=b[i+1]
for i in range(len(c)):
    print(c[i])

Submission status: Accepted

Solution code:
import math
import fractions
import collections
import itertools
d=collections.deque()
N=int(input())
A=list(map(int,input().split()))
tree=[[] for _ in range(N)]
dirtree=[[] for _ in range(N)]
for i in range(N-1):
    tree[i+1].append(A[i]-1)
    tree[A[i]-1].append(i+1)
#print(tree)
d.append(0)
seen=[0]*N
while len(d)>0:
    v=d.popleft()
    seen[v]=1
    for j in tree[v]:
        if seen[j]==0:
            d.append(j)
            dirtree[v].append(j)
    #input()
    #print(d,dirtree)
for i in range(N):
    print(len(dirtree[i]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict

n = int(input())

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

c = defaultdict(int)

for i, item in enumerate(a):
    c[item-1] += 1
    
for i in range(n):
    print(c[i])

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 range(n-1):
    ans[a[i]] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
N=int(input())
list = [int(i) for i in input().split()]
counter = collections.Counter(list)

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

Submission status: Accepted

Solution code:
import collections

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in id_list:
    josi_map[i]+=1

for i in range(people):
    print(josi_map[i+1])

Submission status: Accepted

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

Submission status: Accepted

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

def main():
  result = [0] * int(input())
  arg = [int(i) for i in input().split()]
  
  for i in arg:
    result[i-1] = result[i-1] + 1
  
  for i in result:
    print(i)
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
from collections import defaultdict as dd

n=int(input())
a=list(map(int,input().split()))
d=dd(int)
for i in a:
    d[i]+=1

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

Submission status: Accepted

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

import sys
import math


sys.setrecursionlimit(10 ** 6)

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

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

for a in ans:
    print(a)

Submission status: Accepted

Solution code:
import collections

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
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()))
MOD = 10**9 + 7


N = INT()
A = LIST()
c = Counter(A)

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

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())

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

kazu = [0]*N

for i in range(N-1):
    kazu[As[i]-1] += 1


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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
import sys
input = sys.stdin.readline


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

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

    for ai in result:
        print(ai)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
n = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
B = [0]*n
for i in c.keys():
    B[i-1] = c[i]
for j in range(n):
    print(B[j])

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
# 文字列には注意


def main():
    n = int(input())
    buka = [0] * n
    a = [int(x) for x in input().split()]
    for i in range(n-1):
        buka[a[i] - 1] += 1
    for i in range(n):
        print(buka[i])


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

Submission status: Accepted

Solution code:
import collections
N = int(input())
A = list(map(int, input().split()))
dic = collections.defaultdict(int)
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()))
c = {i:0 for i in range(1,N+1)}
for i in range(N-1):
    c[A[i]] += 1
for i in range(1,N+1):
    print(c[i])

Submission status: Accepted

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

hito = [0 for x in range(n)]
for x in a:
    hito[x-1] += 1

for x in hito:
    print(x)

Submission status: Accepted

Solution code:
n = int(input())

a = [0 for _ in range(n)]
for i in input().split():
  a[int(i)-1] += 1


for i in a:
  print(i)

Submission status: Accepted

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

Submission status: Accepted

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

ansList = [0] * N

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

for i in ansList:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Main(N, A):
    d = {}
    for i in range(1, N+1):
        d[i] = 0
    for e in A:
        d[e] += 1
    return d.values()

def main():
    N = int(input())
    A = list(map(int, input().split()))
    out = Main(N, A)
    for e in out:
        print(e)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections

n = int(input())
l = [int(_) for _ in input().split()]
c = collections.Counter(l)

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

Submission status: Accepted

Solution code:
from collections import Counter

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

counter = Counter()

for v in arr:
    counter[v] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for e in l:
    nums[e-1] += 1

for num in nums:
    print(num)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A=[int(x) for x in input().split()]
B=[0]*N

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

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

Submission status: Accepted

Solution code:

import collections
n=int(input())
s=list(map(int, input().split()))
c=collections.Counter(s)
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()))

a_dic = Counter(a)

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

Submission status: Accepted

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

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

    print('\n'.join(map(str, result)))


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

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

memo = {}
for i in range(N-1):
    Si = A[i]
    try:
        memo[Si] += 1
    except:
        memo[Si] = 1

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

Submission status: Accepted

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

for q in range(N):
    print(array2[q])

Submission status: Accepted

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

members = [0] * N

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

for mem in members:
    print(mem)

Submission status: Accepted

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

for i in M:
	print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict

n = int(input())
A = list(map(int, input().split()))
ans = defaultdict(int)

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

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

Submission status: Accepted

Solution code:
from collections import Counter


def main():
    n = int(input())
    A = [int(e) for e in input().split()]

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(get_ints())
def input(): return sys.stdin.readline().strip()


n = int(input())
Arr = get_array()

child = [0] * (n)

for index, value in enumerate(Arr, 2):
    child[value - 1] += 1

for i in child:
    print(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):
    if C[k]:
        print(C[k])
    else:
        print(0)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
# 整数1個だけ
N = int(input().strip())
A = [int(x) for x in input().strip().split(" ")]

buka = {}
for a in A:
    buka.setdefault(a, 0)
    buka[a] += 1

for n in range(1, N+1):
    print(buka.get(n, 0))

Submission status: Accepted

Solution code:
import numpy as np
import math
import itertools

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())
bosses = [0]*N
ids = list(map(int, input().split()))
for x in ids:
	bosses[x-1] += 1
for y in bosses:
	print(y)

Submission status: Accepted

Solution code:
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(n,r))

# r=input1()
# print(2*math.pi*r)

# n,m=input2()
# A=input_array()

# if n<sum(A):
# 	print(-1)
# else:
# 	print(n-sum(A))

n=input1()
A=input_array()
people={i:0 for i in range(1,n+1)}

for i in range(1,n):
	people[A[i-1]]+=1

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

Submission status: Accepted

Solution code:
n=int(input())
node=[[]for i in range(n+1)]
ans=[0]*(n+1)

a=list(map(int,input().split()))
for i,p in enumerate(a):
    node[p].append(i+2)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ret = [0] * n
for ai in a:
    ret[ai-1] += 1

for ni in ret:
    print(ni)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
*A, = map(int, input().split())
F = {}
for i, a in enumerate(A):
    try:
        F[a] += 1
    except:
        F[a] = 1
for i in range(1, n+1):
    try:
        print(F[i])
    except:
        print(0)

Submission status: Accepted

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

ans_ar = [0]*N

for ii in input_line:
  ans_ar[ii-1] += 1

for ii in ans_ar:
  print(ii)

Submission status: Accepted

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

anss = [0] * N

for A in Aj:
	anss[A-1] += 1

for ans in anss:
	print(ans)

Submission status: Accepted

Solution code:
num = int(input())
shozoku = list(map(int,input().split()))
anslist = [0 for i in range(num)]

for jyousi in shozoku:
    anslist[jyousi-1] += 1

for i in anslist:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

main()

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()))
joushi_dict={}
for i in range(1,n+1):
  joushi_dict[i]=0

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

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

Submission status: Accepted

Solution code:
import time
startTimeProblem=time.time()

import fileinput, sys, itertools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N = In.int()
A = In.ints()

ct = Counter(A)
    
ans = [0]*(N)

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

Out.intsNL(ans)


######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Accepted

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

ans_list = [0] * N

for i in A_list:
    ans_list[i - 1] = ans_list[i - 1] + 1

[print(i) for i in ans_list]

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())#=map(int,input().split())
A=list(map(int,input().split()))
sum={}
for i in A:
    if i in sum.keys():
        sum[i]+=1
    else:
        sum[i]=1
for i in range(1,N+1):
    if  i in sum.keys():
        print(sum[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(1,n+1):
    if c[i] != None:
        print(c[i])
    else:
        print(0)

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

Submission status: Accepted

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

ans = [0]*N

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

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

Submission status: Accepted

Solution code:
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 = input().split()
for i in range(n-1):
    A[i] = int(A[i])

l = [0] * n

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

Submission status: Accepted

Solution code:
n = int(input())
x = [int(w) for w in input().split()]
dt = {}
for i in x:
  dt[i] = dt.get(i,0)+1
for i in range(1,n+1):
  if i in dt:
    print(dt[i])
  else:
    print(0)

Submission status: Accepted

Solution code:
import math

n = int(input())
a = [int(s) for s in input().split()]

ans = [0] * n

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

for a in ans:
    print(a)