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-----
5
1 1 2 2

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

Solutions:
def i_input(): return int(input())


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


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


def i_row(N): return [int(input()) for _ in range(N)]


def i_row_list(N): return [list(map(int, input().split())) for _ in range(N)]


n = i_input()
aa=i_list()
shain=[0]*n
for a in aa:
    shain[a-1]+=1
for s in shain:
    print(s)




import collections

n = int(input())
li = list(map(int,input().split()))
res = [0]*(n+1)
for i in li:
    res[i]+=1
# count = collections.Counter(li)
# print(count)
for i in range(1,len(res)):
    print((res[i]))
# print("0")


# coding=utf-8

def __starting_point():
    N = int(input())
    li = list(map(int, input().split()))

    ans = [0] * (N+1)

    for i in range(len(li)):
        ans[li[i]] += 1

    #print(ans)

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

__starting_point()

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

no_buka = [0 for _ in range(n + 1)]

for i in range(2, n + 1):
    no_buka[a[i]] += 1

for j in range(1, n + 1):
    print((no_buka[j]))


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

ans = [0] * n

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

for i in ans:
    print(i)

import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return list(map(int,input().split()))
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n=k()
l=l()
a=[]
for i in range(n):
  a.append(0)
for i in range(n-1):
  a[l[i]-1]+=1
for i in range(n):
  print((a[i]))


N = int(input())
array = list(map(int,input().split()))
ans = [0]*N
for i in array:
  ans[i-1] += 1

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

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

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

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

print(0)

import collections as c
n=int(input());t=c.Counter(map(int,input().split()))
for i in range(1,n+1): print([0,t[i]][i in t]) 

from collections import Counter

N = int(input())
A = list([int(x) for x in input().split()])

result = dict(Counter(A))

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



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

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

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

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


n = int(input())
A = list(map(int,input().split()))
for i in range(n-1) :
    A[i] = A[i] - 1
res = [[] for i in range(n)]

for i in range(n-1) :
    res[A[i]].append(i)

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

N = int(input())
dct = {}
A = list(map(int, input().split()))
for a in A:
    if a in dct.keys():
        dct[a] += 1
    else:
        dct[a] = 1
for n in range(1, N+1):
    print(dct.get(n, 0))

n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)

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

N = int(input())
A = list(map(int,input().split()))
ans_list = [0]*N

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

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

N = int(input())
A = [0]*(N)
for i in input().split():
    A[int(i)-1] = A[int(i)-1]+1
for i in A:
    print(i)


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


def main():
    N = int(input())
    A = list(map(int,input().split()))
    list_a = [0]*N
    for i in range(len(A)):
        list_a[A[i]-1] += 1

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

main()


n={i+1:0 for i in range(int(input()))}
for i in map(int,input().split()): n[i]+=1
[print(i) for i in n.values()]

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

b = [0]*n

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

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


import sys
readline = sys.stdin.readline

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

ans = [0] * N

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

N = int(input())
A = [int(i) for i in input().split()]
ans = [0]*N
for i in range(N-1):
    ans[A[i]-1] += 1
for i in ans:
    print(i)

# import math
# import statistics
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
# e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

f.sort()
count=1
ans=[0 for i in range(a)]

for i in range(len(f)-1):
    if f[i]==f[i+1]:
        count+=1
    else:
        ans[f[i]-1]=count
        count=1
if count>=1:
    ans[f[-1]-1]=count
for i in ans:
    print(i)

B=[0]*int(input())
for a in map(int,input().split()):B[a-1]+=1
for b in B:print(b)

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

result = [0] * N

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


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

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


# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
n = int(input())
A = list(map(int, input().split()))
b = [0]*(n+1)
for i in A:
    b[i]+=1
for i in range(1, n+1):
    print((b[i]))


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

import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

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

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

for i in range(1, n):
    tmp[A[i - 1]].append(i + 1)
res = "\n".join([str(len(r)) for r in tmp[1:]])

print(res)


import copy
n=int(input())
A=list(map(int,input().split()))
L=[0]*n

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


import collections


def main() -> None:
    n = int(input())
    boss_dict = collections.Counter(tuple(map(int, input().split())))

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

    return


def __starting_point():
    main()

__starting_point()

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

import collections
N = int(input())
a = list(map(int, input().split()))
l = [0]* N

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


from typing import List


def answer(n: int, a: List[int]) -> List[int]:
    result = [0] * n
    for i in a:
        result[i - 1] += 1
    return result


def main():
    n = int(input())
    a = list(map(int, input().split()))
    for i in answer(n, a):
        print(i)


def __starting_point():
    main()
__starting_point()

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


def calc(n, m):
    import collections
    edict = dict()
    for i in range(1, len(m) + 2):
        edict[i] = []
    for j in range(len(m)):
        edict[m[j]].append(j)
    for k in edict:
        print((len(edict[k])))


def main():
    n = int(input())
    employees = list(int(v) for v in input().split())
    return calc(n, employees)


def __starting_point():
    main()

__starting_point()

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

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


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

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

for m in ans:
    print(m)


# author:  Taichicchi
# created: 12.09.2020 19:50:20

from collections import Counter
import sys

N = int(input())

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


c = Counter(A)

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


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

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

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    L = LI()
    D = [0]*N

    for index, num in enumerate(L[::-1]):
        D[num-1]+=1
    for i in D:
        print(i)
    
def __starting_point():
    main()
__starting_point()

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

N = int(input())
A = [0] * 2 + list(map(int, input().split()))

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

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


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

emp = [0]*(n+1)

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

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


import sys

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

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

for a in ans:
    print(a)

from collections import Counter

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

s = Counter(a)

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

n = int(input())

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

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

import collections as c
n,t=int(input()),c.Counter(map(int,input().split()))
for i in range(1,n+1): print([0,t[i]][i in t])

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

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

n = int(input())
a = [int(s) for s in input().split()]
b = [0] * n
for i in a:
    b[i - 1] += 1

for i in b:
    print(i)

n = int(input())
a = list(map(int, input().split()))
number_buka = [0]*n

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

for j in number_buka:
    print(j) 

N = int(input())
A = list(map(int, input().split()))
answer = [0] * N

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

for n in answer:
  print(n)

n = int(input())
employees = input().split(" ")
employees_changed = []
for i in range(0, len(employees)):
	employees_changed.append(int(employees[i]))

ans = [0] * (n+1)
for x in employees_changed:
	ans[x] += 1

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


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)

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


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

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

ans = [0] * n

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


for x in ans:
    print(x)

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

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

ANS = []
for i in range(N):
    ANS.append(0)


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

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

n=int(input())
w=list(map(int,input().split()))
a=[0]*(n)

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

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

n = int(input())
a = [int(x) for x in input().split()]
m = {i : 0 for i in range(1, n+1)}

for i, x in enumerate(a):
  m[x] += 1

for x in range(1, n+1):
  print(m[x])

num = int(input())
table = list(map(int, input().split()))
table2 = []
for i in range(num):
    table2.append(0)

for j in range(len(table)):
    table2[table[j]-1] += 1

for k in table2:
    print(k)


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

c=[0]*n

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

for i in c:
    print(i)

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


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

n = int(input())
a = [0] + list(map(int,input().split()))
l = [0]*n
for i in a:
    l[i-1] += i
for j in range(n):
    l[j] = int(l[j]/(j+1))
for k in l:
    print(k,end="\n")

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

ans = [0] * (n+1)

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

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


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)

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

n = int(input())

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

d = {}

for i in range(n-1):
    boss = a[i]
    d[boss] = d.setdefault(boss,0) + 1

for i in range(n):
    ans = d.setdefault(i+1,0)
    print(ans)




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

hie_dic = {}

for i in range(N - 1):
    hie_dic[i + 1] = 0
    hie_dic[hie_list[i]] += 1

for i in range(N - 1):
    print(hie_dic[i + 1])
print(0)

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

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

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

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

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

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

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

n = int(input())
aa = [0]+list(map(int, input().split()))
buka = [0]*n

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

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

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

def __starting_point():

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

    B = [0]*n
    for a in A:
        B[a-1] += 1
    for b in B:
        print(b)


__starting_point()

N = int(input())
A = list(map(int,input().split()))
#A.reverse()
ans = [0 for _ in range(N)]
for i in reversed(range(N-1)):
  #今i番目(0index)の社員
  boss = A[i]-1 #0index
  ans[boss] += 1
  #print(ans,i,boss)
for x in ans:
  print(x)

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