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):
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()))
p = []
for i in range(N):
    p.append(0)
for i in range(len(a)):
    p[a[i]-1] = p[a[i]-1] + 1
for num in p: 
    print(num)

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+1)
for a in A:
    B[a]+=1
for b in B[1:]:
    print(b)

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

Solution (Python):
import sys, re
import math
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul	
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd	
from heapq import heappush, heappop

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7


n = INT()
a = LIST()
list = [0] * (n + 1)

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

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

Solution (Python):
import sys
stdin = sys.stdin

     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
N=int(input())
A=nl()


l_b=[0]*N

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

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

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

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ch = [0] * N
    for i in range(N - 1):
        ch[A[i] - 1] += 1
    print('\n'.join(map(str, ch)))


if __name__ == '__main__':
    main()

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

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

for i in As:
    res[i-1] += 1

for i in res:
    print(i)

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

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

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

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

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

print(*A)

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

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

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

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

Solution (Python):
import sys
from operator import itemgetter
import collections
import math

def r(n, a):
    d = [0] * n
    for aa in a:
        d[aa-1] = d[aa-1] + 1
    for nn in range(n):
        print(d[nn])


def main():
    input = sys.stdin.readline
    n = int(input())
    a = list(map(int, input().split()))
    r(n, a)

    
if __name__ == '__main__':
    main()

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

result = [0] * N

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

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

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

ans = [0]*a
for i in range(a-1):
    ans[li[i]-1] += 1
    
for j in range(a):
    print(ans[j])

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

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

Solution (Python):
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n = int(input().strip())
    a = list(map(lambda x : int(x) - 1, input().strip().split()))
    
    l=[0 for i in range(n)]
    for i in range(n-1):
        l[a[i]]+=1
        
    for i in range(n):
        print(l[i])
if __name__ == '__main__':
    main()

Solution (Python):


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

subordinate_list = [0] * n
for boss in boss_list:
  subordinate_list[boss - 1] += 1

for subordinate in subordinate_list:
  print(subordinate)

Solution (Python):
def main():
    """"ここに今までのコード"""
from collections import Counter

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

dic = Counter(lis)

for i in range(1, n+1):
	print(dic[i])
    
    
if __name__ == '__main__':
    main()

Solution (Python):

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

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

for j in range(n):
	print("%d" % staff[j])

Solution (Python):

from collections import Counter

def solve():
    N = int(input())
    c =  Counter(input().split())
    return '\n'.join([str(c.get(str(i),0)) for i in range(1, N+1)])


if __name__ == '__main__':
    print(solve())

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

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

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

Solution (Python):
n = int(input())
a = [int(ai) for ai in input().split(" ")]

joushi_buka = [0 for ni in range(n)]
for ai in a:
    joushi_buka[ai-1] += 1

for jb in joushi_buka:
    print(jb)

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

ans=[0]*N

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

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

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

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

x = [0 for i in range(n)]

for j in range(n-1):
    x[l[j]-1] +=  1

for k in x:
    print(k)

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

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

S = [0] * (N+1)

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

for s in S[1:]:
    print(s)

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

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

print('\n'.join(list(map(str, ans))))

Solution (Python):
from collections import defaultdict
n = int(input())
a = [int(x) for x in input().split()]
upper = defaultdict(int)
for i in range(1,n+1):
    upper[i] = 0
for i in a:
    upper[i] += 1
ans = sorted(upper.items())
for k,v in ans:
    print(v)

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
S=[0]*N
for i in A:
    S[i-1]+=1
for i in S:
    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()))
import collections
c = collections.Counter(A)


for i in range(1, N+1):
    if c.get(i) != None:
        print(c.get(i))
    else:
        print(0)

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

for j in A:
    dictio[j] += 1

L = dictio.values()
print(*L, sep="\n")

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

Solution (Python):
import collections

N=int(input())
X=list(map(int, input().split()))
c = collections.Counter(X)

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

Solution (Python):
import sys
N = int(input())
A = list(map(int, sys.stdin.readline().strip().split()))

ans = [0] * N
ans[0] = 0

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

for A in ans:
    print(A)

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

for i in a:
  num[i]+=1
  
for j in range(1,n+1):
  print(str(num[j]))

Solution (Python):
n=int(input())
li=[int(x) for x in input().split()]
d={}
for i in range(len(li)):
	if li[i] in d:
		d[li[i]]+=1
	else:
		d[li[i]]=1

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

Solution (Python):
n = int(input())
aa = map(int, input().split())
sub = [0]*n
for a in aa:
    sub[a-1] += 1

for s in sub:
    print(s)

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

result = [0]*N

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

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

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

Solution (Python):
import sys
input=sys.stdin.readline

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

Solution (Python):


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

    count = [0] * (N)

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

    for s in range(len(count)):
        print(count[s])






if __name__ == '__main__':
    main()

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

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

cnts = [0 for _ in range(n)]
for ai in a:
    cnts[ai] += 1

for cnt in cnts:
    print(cnt)

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

s = input().split(" ")
count = [0 for i in range(1,num+1)]

for i in range(num-1):
    count[int(s[i])-1] += 1

for i in count:
    print(i)

Solution (Python):
n = int(input())
odata = input().split(' ')
data = [int(odata[i]) for i in range(n - 1)]
result = [0 for i in range(n)]
for per in data:
    result[per - 1] += 1

for per in result:
    print(per)

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

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

result = [0 for x in range(0, n)]

for i, v in enumerate(a):
	result[v-1] += 1

for i, v in enumerate(result):
	print(v)

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

Solution (Python):

import sys, copy, math, heapq, bisect
from itertools import accumulate
from collections import deque, defaultdict, Counter
input = sys.stdin.readline 
sys.setrecursionlimit(500000)

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

d = {}
for i in range(1, n+1):
    d[i] = 0

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

for k, v in d.items():
    print(v)

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

for i in range(len(a_list)):
    dp[a_list[i]-1] += 1

for j in range(len(dp)):
    print(dp[j])

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

if __name__ == '__main__':
  main()

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

Solution (Python):
from collections import Counter

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

A_count = Counter(A)

ans_list = [0] * N
for key in A_count:
  ans_list[key - 1] = A_count[key]
  
print(*ans_list)

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

map = [[i, 0] for i in range(1, n+1)]

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

for i in range(n):
    print(map[i][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 j in range(n):
    print(B[j])

Solution (Python):



import sys


def input():
    return sys.stdin.readline()


def resolve():
    n = int(input())
    a_list = list(map(int, input().split()))


    ans_list = []
    ans_list.append(0)
    for i in range(len(a_list)):
        ans_list.append(0)

    for ai in a_list:
        ans_list[ai-1] += 1

    for answer in ans_list:
        print(answer)




if __name__ == "__main__":
    resolve()

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

A.insert(0,0)
mem_id = collections.Counter(A)
sub = []
for i in range(0,N):
    print(mem_id[i + 1])

Solution (Python):
from collections import Counter

N = int(input())

c = Counter(map(int, input().split()))
for i in range(1, N+1):
  print(c[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 = [int(i) for i in input().split()]
b = [0] * n
for i in a:
    b[i - 1] += 1
for i in b:
    print(i)

Solution (Python):
import collections
n=int(input())
a=list(map(int,input().split()))
dic=collections.Counter(a)
for i in range(1,n+1):
    if i in dic.keys():
        print(dic[i])
    else:
        print(0)

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

Solution (Python):
import sys
from collections import Counter

lines = 2
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


n = int(inp[0])
a_lst = inp[1].split()

c = Counter(a_lst)

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

Solution (Python):
from collections import Counter
n = int(input())
a_L = list(map(int,input().split()))
a_L = Counter(a_L)
dic = {}

for i,v in a_L.items():
    dic[i] = v
for i in range(n):
    try:
        print(dic[i+1])
    except:
        print(0)

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

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

lis=[0]*N

for j in range(0,N-1):
  lis[S[j]-1]+=1
  
  
for i in range(N):
  print(lis[i])

Solution (Python):
import collections

n = int(input())

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

cnts = collections.Counter(nums)

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

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

for i in ls:
    print(i)

Solution (Python):

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

ans = [0] * n

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

for item in ans:
    print(item)

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

if N==2:
    print(1)
    print(0)
else:
    from collections import deque
    da=deque(A)
    
    import numpy as np
    ansl=np.array([0]*N)
    
    for i in range(N-1):
        ansl[da.pop()-1]+=1
    
    for i in ansl:
        print(i)

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

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

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

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]

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

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

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

for a in ans:
	print(a)

Solution (Python):
from collections import defaultdict

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

buka = defaultdict(int)

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

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

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

data = input().split()
jousi = [int(s) for s in data]

buka = [0]*n

for i in jousi:
  buka[i - 1] += 1

for i in buka:
  print(i)

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

for a in A:

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

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

c = collections.Counter(A)
ans = [0]*N

for ci in c.items():
    ans[ci[0]-1]=ci[1]

for i in ans:
    print(i)

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):
import numpy as np
N=int(input())
A=[int(x) for x in input().split()]
X=[0]*300000
for i in range(N-1):
    tmp=A[i]
    X[tmp]+=1
for i in range(1,N+1):
    print(X[i])

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

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

Solution (Python):
import numpy as np

def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    args = input().rstrip().split(' ')
    A = np.array([int(val) for val in args])
    sup = np.zeros(N-1, dtype=np.int)
    
    for a in A:
        sup[a-1] += 1
    for val in sup:
        print(val)
    print(0)
    
if __name__ == "__main__":
    main()

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

Solution (Python):
from collections import Counter

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

num_counter = Counter(num_list)
num_keys = num_counter.keys()

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

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

for i in range(n-1):
    count[id[i]-1] += 1
for i in range(n):
    print(count[i])

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

for i in range(N):
    print(c[i+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 j in B:
  print(j)

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(lambda x:int(x) - 1, input().split()))
jousi = [-1 for _ in range(n)]
for i in range(n-1):
    jousi[i + 1] = a[i]

buka = [0 for _ in range(n)]
for i in jousi:
    if i >= 0:
        buka[i] += 1

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

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

for i in ans:
    print(i)

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

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

Solution (Python):
N = int(input())
arr = [int(el) for el in input().split()]
d = {}
for i, sup in enumerate(arr):
    if sup in d:
        d[sup].append(i)
    else:
        d[sup] = [i]
for i in range(1, N + 1):
    print(len(d[i]) if i in d else 0)

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

for i in range(len(A)):
    li[A[i]] += 1
for i in range(1, len(li)):
    print(li[i])
print(0)

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

Solution (Python):
n=int(input())
A=tuple(map(int,input().split()))
Ans=[0]*n
for a in A:
    Ans[a-1]+=1
print(*Ans,sep='\n')

Solution (Python):

import sys
input = sys.stdin.readline

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

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

for a in ans:
    print(a)

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

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

s=input().split()

ans=[0 for i in range(n)]
for i in range(0,n-1):
    s[i]=int(s[i])
    ans[s[i]-1]+=1

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

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

ans_al = [0]*n




for a in al:
    ans_al[a-1] += 1

for ans in ans_al:
    print(ans)

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
print("\n".join(list(map(str, B))))

Solution (Python):
n = int(input())
a  = list(map(int, input().split()))
import numpy  as np
a = np.array(a)
ans = np.zeros(n)
for i in a:
  ans[i-1] += 1
for i in ans:
  print(int(i))

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

Solution (Python):
n=int(input())
a=[0]*(n-1)
a=list(map(int,input().split()))
a=sorted(a)
ans=0
target=1
j=0
for i in range(n):
    if (j<n-1):
        while(a[j]==target):
            ans+=1
            j+=1
            
            if (j>n-2):
                break
    print(ans)
    ans=0
    target+=1

Solution (Python):
N = int(input())
emp = [0]*(N+1)
sup = [int(_) for _ in input().split()]
for i in sup:
    emp[i] += 1

[print(_) for _ in emp[1:]]

Solution (Python):
N=int(input())
mylist=list(map(int,input().split()))
member=[]
for i in range(N):
    member.append(0)

for i in range(N-1):
    number=mylist[i]
    member[number-1]+=1
    
for i in range(N):
    print(member[i])

Solution (Python):
import sys

input = sys.stdin.readline

n = int(input())
b = [0]*n
s = list(map(int,input().split()))

for v in s:
    b[v-1] += 1
for bb in b:
    print(bb)

Solution (Python):
from collections import Counter

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

zyoshi_counter = Counter(A)

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

Solution (Python):


num = int(input())

shain = input().split(" ")
kazu = []
for i in range(len(shain)):
    shain[i] = int(shain[i])
    
for i in range(num):
    kazu.append(0)
    
for j in range(len(shain)):
    kazu[shain[j] - 1] += 1
    
for k in range(num):
    print(kazu[k])

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

Solution (Python):
N = int(input())
Alist = list(map(int, input().split()))
boss = {}
for i in Alist:
    if i not in boss:
        boss[i] = 1
    else:
        boss[i] += 1
for j in range(1,N+1):
    if j in boss:
        print(boss[j])
    else:
        print(0)

Solution (Python):
from collections import Counter

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

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

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

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

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

for i in result:
    print(i)

Solution (Python):

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

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

Solution (Python):
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    N = I()
    A = LI()
    res = [0]*N
    for i, a in zip(range(N), A):
        res[a-1] += 1
    for i in range(N):
        print(res[i])

if __name__ == '__main__':
    main()

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

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

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

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

nl = [0 for _ in range(n)]
for e in ass:
  nl[e-1] += 1

for e in nl:
  print(int(e))

Solution (Python):
from collections import Counter

N,*A = map(int,open(0).read().split())
c = Counter(A)
for i in range(1,N+1):
    if i not in c:
        print(0)
    else:
        print(c[i])

Solution (Python):
n=int(input(''))
a=input('')
a=a.split(' ')
for i in range(n-1):
    a[i]=int(a[i])

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

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

for i in l:
    print(i)

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

from collections import Counter

a=Counter(a)

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

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

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):
INT_MAX=10**18+7
MOD=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]

n=int(input())
A=INPUT()
ans=[0 for i in range(n+1)]
for i in range(n-1):
    
    ans[A[i]]+=1
for i in range(1,n+1):
    print(ans[i])

Solution (Python):
N = int(input())
li = list(map(int, input().split()))
dic = {}
for n,i in enumerate(li):
    buka = n+1
    zyousi = i
    if zyousi in dic.keys():
        dic[zyousi].append(buka)
    else:
        dic[zyousi] = [buka]
for n in range(N):
    if n+1 in dic.keys():
        print(len(dic[n+1]))
    else:
        print(0)

Solution (Python):
n=int(input())
t=list(map(int,input().split(' ')))
x=[0]*n
for i in range(n-1):
    x[t[i]-1]+=1
for i in x:
    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):
n = int(input())
A = list(map(int,input().split()))
ans = [0]*(n+1)
for i in range(n-1):
    ans[A[i]]+=1

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