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):
import collections
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 range(N):
    print(l[j])

Solution (Python):
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())


n=int(input())
ar=lis()
temp=[0]*(n+5)
for i in range(n-1):
    
    temp[ar[i]]+=1
for i in range(1,n+1):
    print(temp[i])

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

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

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

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

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

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

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

Solution (Python):
import math
n = int(input())
c= [0]*n
s = map(int,input().split())

for i in s:
  c[i-1]+=1

for i in c:
  print(i)

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

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

Solution (Python):
a= int(input())
b = list(map(int,input().split()))
b = list(map(lambda x : x-1,b))

bukas = [[]for i in range(a)]
for i in range(1,a):
    bukas[b[i-1]].append(i)
for c in bukas:
    print(len(c))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: x - 1, A))

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

for b in bukas:
    print(len(b))

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

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

Solution (Python):
import sys

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] ,end=" ")

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

Solution (Python):
from collections import defaultdict
N=int(input())
A=list(map(int, input().split()))
dd=defaultdict(int)
for i in range(1, N+1):
	dd[i]+=0
	if i>=2:
		dd[A[i-2]]+=1
for k, v in dd.items():
	print(v)

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

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

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

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

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

count = collections.Counter(A)
ans = []

for i in range(1,N+1):
    ans.append(count[i])
    
    
[print(x) for x in ans]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

for a in ans:
    print(a)

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

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

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

ans = [0] * n

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

for i in ans:
    print(i)

Solution (Python):



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

Solution (Python):

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


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

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

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

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

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

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

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

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

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

ans = [0 for _ in range(N)]
for i in reversed(range(N-1)):
  
  boss = A[i]-1 
  ans[boss] += 1
  
for x in ans:
  print(x)

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

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

Solution (Python):

from sys import stdin, stdout



def input():
	a = stdin.readline()
	if a[-1] == "\n": a = a[:-1]
	return a
def print(*argv, end="\n", sep=" "):
	n = len(argv)
	for i in range(n):
		if i == n-1: stdout.write(str(argv[i]))
		else: stdout.write(str(argv[i]) + sep)
	stdout.write(end)

mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def fact(x, mod=mod):
	ans = 1
	for i in range(1, x+1): ans = (ans * i) % mod
	return ans
def arr2D(n, m, default=0):
	lst = []
	for i in range(n): temp = [default] * m; lst.append(temp)
	return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}

def solve(n, lst):
	map1 = {}
	for i in lst:
		if map1.get(i) == None: map1[i] = 1
		else: map1[i] += 1
	for i in range(1, n+1):
		if map1.get(i) == None: print(0)
		else: print(map1.get(i))

n = int(input())
lst = list(map(int, input().split()))
solve(n, lst)

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

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

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

Solution (Python):


a=int(input())





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


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)

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

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

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

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

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]

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

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

Solution (Python):
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict 
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  
  
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright





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

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

for b in buka:
  print(b)

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

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

for b in buka:
    print(b)

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

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

a = collections.Counter(A)

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

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

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

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
d = {}
for i in range(1,n+1):
    if i not in d:
        d[i] = 0

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

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

Solution (Python):
N = int(input())
boss = [0] * N
A = map(lambda x:int(x) - 1, input().split())

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

print(*boss, sep='\n')

Solution (Python):
from collections import Counter

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

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

Solution (Python):

import sys
from itertools import chain


def solve(N: int, A: "List[int]"):
    s = [0 for _ in range(N)]
    for Ai in A:
        s[Ai - 1] += 1

    return "\n".join(map(str, s))


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    N = int(next(tokens))  
    A = [
        int(next(tokens)) for _ in range(N - 2 + 1)
    ]  
    answer = solve(N, A)
    print(answer)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math

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

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

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
A_dict = {}
for a in A:
    if A_dict.get(a):
        A_dict[a] += 1
    else:
        A_dict[a] = 1
B = [0] * N
for i in range(N+1):
    if A_dict.get(i):
        B[i-1] = A_dict[i]
for b in B:
    print(b)

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
from collections import defaultdict
numsubs=defaultdict(int)
for sub in A:
    numsubs[sub]+=1
for k in range(N):
    print(numsubs[k+1])

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

Solution (Python):
N = int(input())
A_ls = list(map(int, input().split(' ')))
rst = [0] * N
for i in A_ls:
    rst[i - 1] += 1
for i in rst:
    print(i)

Solution (Python):

def main():
    n = int(input())
    a = list(map(lambda i:int(i)-1, input().split(" ")))
    d = {}
    for i in range(n):
        d[i]=0
    for i in range(n-1):
        d[a[i]] += 1
    for i in range(n):
        print(d[i])

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
bosses = [0 for _ in range(N+1)]
for boss in A:
  bosses[boss] += 1
for i in range(1, N+1):
  print(bosses[i])

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

Solution (Python):
import collections

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

k=collections.Counter(A)

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

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

ans_list = [0]*n
for boss in bosses:
    ans_list[boss-1] += 1

for ans in ans_list:
    print(ans)

Solution (Python):
N = int(input())
rst = [0] * N
A_ls = list(map(int, input().split(' ')))
for i in A_ls:
    rst[i - 1] += 1
for i in rst:
    print(i)

Solution (Python):


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

s = [0]*n
level = 1
al.sort()
for i in range(len(al)):
    if al[i] == level:
        s[level-1] += 1
    elif al[i] >= level:
        level = al[i]
        s[level-1] += 1

for j in s:
    print(j)

Solution (Python):
from collections import Counter

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

c = Counter(A)

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

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

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

Solution (Python):
N = int(input())
ls = list(map(int, input().split(' ')))
rst = [0] * N
for i in ls:
    rst[i - 1] += 1
for i in rst:
    print(i)

Solution (Python):
from collections import Counter

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    a_c = Counter(a)
    for i in range(1, n+1):
        ans = a_c.get(i)
        if ans:
            print(ans)
        else:
            print(0)
        
if __name__ == '__main__':
    main()

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

anslist = [0]*(N+1)
for i in range(len(Alist)):
  anslist[Alist[i]]+=1

for i in range(len(anslist)):
  if i!=0:
    print (anslist[i])

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


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

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

p2 = [0]*n 

for x in p:
    p2[x-1] = p2[x-1] + 1

for x in p2:
    print(x)

Solution (Python):
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

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

Solution (Python):
from collections import Counter

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

c = Counter(a)

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

Solution (Python):
n = int(input())
lst = list(map(int,input().split()))
lst2 = [0 for i in range(n)]
for i in range(n - 1):
  x = lst[i]
  lst2[x - 1] = lst2[x - 1] + 1
for i in range(n):
  print(lst2[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_ls = map(int, input().split(' '))
ls = [0] * N
for i in A_ls:
    ls[i - 1] += 1
for i in ls:
    print(i)

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

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
ans = [0 for i in range(N)]
for i in range(len(L)):
  ans[L[i]-1] += 1
for i in range(N):
  print(ans[i])

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for ni in range(n):
  dic[ni+1] = 0
for ai in a:
  dic[ai] += 1
for di in dic:
  print(dic[di])

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

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

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

Solution (Python):

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


d = {}
for num in a:
    d[num] = d.get(num, 0) + 1


for i in range(1, len(a)+2):
    if i in d:
        print(d[i])
    else:
        print(0)

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

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

Solution (Python):
N = int(input())
rst = [0] * N
A_ls = map(int, input().split(' '))
for i in A_ls:
    rst[i - 1] += 1
for i in rst:
    print(i)

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

Solution (Python):

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

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

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

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

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

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

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

Solution (Python):
import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter



input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def solve():
    n = getN()
    li = [0 for i in range(n)]
    for nn in getList():
        
        li[nn-1] += 1

    for nn in li:
        print(nn)

def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    
    solve()

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

s = []

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

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

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

A_0 = [x - 1 for x in A]

ans = [0] * N 

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

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

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

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

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

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

for i in range(len(A)):
    sup[A[i]-1] += 1

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

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

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

for i in Subordinate:
    print(len(i))

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

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

l = [0]*N

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

print(*l, sep="\n")

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

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

for i in k:
  print(i)

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
cnt = [0 for x in range(N)]
for i in range(len(A)) :
    cnt[A[i]-1] += 1

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

Solution (Python):
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    lst = [0 for _ in range(2 * 10 ** 5 + 1)]

    for a in a_lst:
        lst[a] += 1

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


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    dic = dict()

    for i in range(n - 1):
        if a_lst[i] in dic:
            dic[a_lst[i]] += 1
        else:
            dic[a_lst[i]] = 1

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


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
p = list(map(int, input().split()))
sya = [0]*N
t = 0



for i in range(N-1):
  t = p[i-1]
  sya[t-1] +=1



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

Solution (Python):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a += list(range(1,n+1))
a = Counter(a).most_common()
a.sort()
for i,j in a:
    print(j-1)

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

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

for t in T:
    print(t)

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

for i in anslst:
    print(i)

Solution (Python):
import collections

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

c = collections.Counter(A)

ans = []
for i in range(N):
    ans.append(c[i + 1])

[print(i) for i in ans]

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

for boss in a:
    ans[boss-1] += 1
    
for sub in ans:
    print(sub)

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

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

[print(i) for i in ans]

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

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

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

[print(i) for i in arr]

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

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

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

print(*ans, sep="\n")

Solution (Python):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    Subs = [0 for _ in range(N)]
    for i, a in enumerate(A):
        Subs[a-1] += 1
    [print(n) for n in Subs]

if '__main__' == __name__:
    resolve()

Solution (Python):
N = int(input())
import sys
input = sys.stdin.readline
lis = {}
A = list(map(int, input().split()))
for i in range(N-1):
  x = A[i]
  if x in lis:
    lis[x] += 1
  else:
    lis[x] = 1
for i in range(1, N+1):
  if lis.get(i) == None:
    print(0)
  else:
    print(lis.get(i))

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


A.sort()
A.append(N + 1)
ans = [0] * (N+1)
count = [0, 0]

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

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

Solution (Python):
N = int(input())
A_ls = list(map(int, input().split(' ')))
ls = [0] * N
for i in A_ls:
    ls[i - 1] += 1
for i in ls:
    print(i)