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

Solution (Python):
N = int(input())
ls = list(map(int, input().split()))

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

for i in ls:
  tmp[i] += 1

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

Solution (Python):
import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]
from collections import Counter

def main():
    n = II()
    aa = [0] + MII()
    c = Counter(aa)
    for i in range(n):
        print(c[i+1])


if __name__ == '__main__':
    main()

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

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

Solution (Python):
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)

Solution (Python):

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])

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

for i in range(1,N):
    B[A[i-1]-1]+=1
    
print('\n'.join(map(str,B)))

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

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

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

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

Solution (Python):
import math
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
n = ii()
a = li()
b = [0]*(n+10)
for i in range(n-1):
    b[a[i]-1]+=1
for i in range(n):
    print(b[i])

Solution (Python):
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)


inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
from collections import deque, defaultdict, Counter
import math
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))



def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def main():
    N = int(input())
    A = wi()
    d = defaultdict(int)
    for i in range(0, N-1):
        d[A[i]] += 1
    
    for i in range(N):
        print(d[i+1])


if __name__ == '__main__':
    main()

Solution (Python):
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(0,N):
    print(ans[i])

Solution (Python):


import sys
import math
import bisect
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
lmtx = lambda h: [list(map(int, lmis())) for _ in range(h)]
sys.setrecursionlimit(1000000000)


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



n = ii()
alist = lmis()

jlist = [0] * (n+1)

for i in range(n-1):
    jlist[alist[i]] += 1

for j in jlist[1:]:
    print(j)

Solution (Python):
N = int(input())
A = list(input().split(" "))
A = [int(i) for i in A]
joushi={}
for i in range(1,N+1):
    joushi[i]=0
for i in A:
    if i in joushi:
        joushi[i]+=1
for v in joushi.values():
    print(v)

Solution (Python):
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)

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

dict = {}

for i in range(len(a)):
  dict[i]=0

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

print(0)

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

    
    

    dict = {}
    for num in A:
        if num in dict:
            dict[num] += 1
        else:
            dict[num] = 1

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


if __name__ == '__main__':
    main()

Solution (Python):
import collections

N = int(input())

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

c = collections.Counter(A)

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

Solution (Python):


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    from collections import defaultdict
    count = defaultdict(int)
    for a in A:
        count[a] += 1

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


if __name__ == '__main__':
    main()

Solution (Python):
import collections


def main():
    n = int(input())
    a = input_list()
    ac = collections.Counter(a)
    for i in range(n):
        if i+1 in ac:
            print(ac[i+1])
        else:
            print(0)


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


main()

Solution (Python):
def main(n: int, a: list):
    t = [0 for _ in range(n)]

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

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


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

    main(n, a)

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

Solution (Python):

import math



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

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

    for elem in a:
        boss_num_list[elem-1] += 1

    for ans in boss_num_list:
        print(ans)

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

Solution (Python):


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

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

for a in ans:
    print(a)

Solution (Python):
import numpy as np

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

M = np.zeros(N)

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

Solution (Python):

a=int(input())
syali=[0] * a
li=list(map(int,input().split()))

for i in li:
    syali[i-1]+=1

for i in syali:
    print(i)

Solution (Python):
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)

Solution (Python):
N = int(input())
ARR = list(map(int,input().split()))

def calculate(n,arr):

    result = [set() for i in range(n)]

    for index,ar in enumerate(arr):
        ar = ar - 1
        result[ar].add(index+1)


    for res in result:
        print(len(res))

calculate(N,ARR)

Solution (Python):
n = int(input())
arr = map(int, input().split())
d = {}
for i in arr:
    i -= 1
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1

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

Solution (Python):
N = int(input())

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

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


for jyo in A:
    shine[jyo-1] += 1
    

for s in shine:
    print(s)

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

ans=[0]*n

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

Solution (Python):
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)

Solution (Python):
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)

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

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):




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=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])
    
    

    return

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

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
n = int(input())
a = [0]+list(map(int, input().split()))

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

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)))

Solution (Python):
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)

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

ans=[0]*n

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

Solution (Python):
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()

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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])

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


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

Solution (Python):
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])

Solution (Python):
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()

Solution (Python):
import math
import sys
import collections

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

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
from collections import Counter
def readInt():
    return list(map(int,input().split()))
n = int(input())
a = readInt()
ans = Counter(a)

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

Solution (Python):
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])

Solution (Python):
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')

Solution (Python):
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])

Solution (Python):
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)

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

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

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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])

Solution (Python):


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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):

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()

Solution (Python):
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)

Solution (Python):
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])

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

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

Solution (Python):
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])

Solution (Python):

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()

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

Solution (Python):
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()

Solution (Python):
import collections

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

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

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):

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])

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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])

Solution (Python):
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()

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
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])

Solution (Python):
import collections
N = int(input())
A = list(map(int, input().split()))

c = collections.Counter(A)

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

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):

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))

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime

def input1():
	return int(input())


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


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))












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)