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())
node=[[]for i in range(n+1)]
ans=[0]*(n+1)

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

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

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

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

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

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

for ni in ret:
    print(ni)

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

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

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

ans_ar = [0]*N

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

for ii in ans_ar:
  print(ii)

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

anss = [0] * N

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

for ans in anss:
	print(ans)

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

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

for i in anslist:
    print(i)

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

main()

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):
n=int(input())
a=list(map(int,input().split()))
joushi_dict={}
for i in range(1,n+1):
  joushi_dict[i]=0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

In = InputHelper()
Out = OutputHelper()



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

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

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

Out.intsNL(ans)




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

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] = ans_list[i - 1] + 1

[print(i) for i in ans_list]

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

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

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

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

Solution (Python):
import collections

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

c = collections.Counter(a)
for i in range(1,n+1):
    if c[i] != None:
        print(c[i])
    else:
        print(0)

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

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

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

l = [0] * n

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

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

Solution (Python):
import math

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

ans = [0] * n

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

for a in ans:
    print(a)

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())
l=[int(i) for i in input().split()]
l1=[0]*n
for i in range(n-1):
	l1[l[i]-1]+=1
for i in range(n):
	print(l1[i])

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

Solution (Python):
t = int(input())
A = list(map(int,input().split()))
B = [0]*t
for i in range(t-1):
    B[A[i]-1] += 1
for i in range(t):
    if B[i]!= -1:
      print(B[i]) 
    else:
      print(0)

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

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

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

Solution (Python):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = [0]*n
c_a = Counter(a)
c_a_v = c_a.items()

for i, j in c_a_v:
    cnt[i-1] = j

for k in cnt:
    print(k)

Solution (Python):
import math
import queue

def readInt():
	return int(input())

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

def readChars():
	return input().split()


x = readInt()

a = readInts()

r = [0]*x

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

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

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

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

a = [0]*n

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


dic = {}
for s in a:
    if not (s in dic):
        dic[s] = 1
    else:
        dic[s] += 1


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

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

ans = [0] * (N + 1)
for i, Ai in enumerate(A):
    ans[Ai] += 1

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

Solution (Python):
n = int(input(''))
alist = input('').split(' ')

h = {}
for i in range(1,n):
    a = int(alist[i-1])
    if not a in h.keys():
        h[a]=0
    h[a]+=1

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

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

Solution (Python):
n=int(input())
arr=list(map(int,input().strip().split()))[:n-1]
dict1={}
for i in arr:
	if i in dict1:
		dict1[i]+=1
	else:
		dict1[i]=1
for i in range(1,n+1):
	if i in dict1:
		print(dict1[i])
	else:
		print(0)

Solution (Python):

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

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

for i in range(N - 1):
    ans_list[A_list[i] - 1] += 1

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

Solution (Python):
import sys
from collections import Counter

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

c = Counter(A)
for i in range(1, N + 1):
    print(c.get(i, 0))

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

tmp_lst = [0]*(n+1)

for i in lst:
    tmp_lst[i] += 1

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

Solution (Python):
def main():
    n = int(input())
    joushi = list(map(int,input().split()))
    lst = [0] * n
    for i,j in enumerate(joushi):
        lst[j-1] += 1

    for n in lst:
        print(n)

main()

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

mem_dict = {i:[] for i in range(1, n+1)}
for i, boss in enumerate(a_list):
  mem_dict[boss].append(i)
  
for v in mem_dict.values():
  print(len(v))

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

for i in range(n - 1):
    relation_list[a_list[i] - 1] += 1

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

Solution (Python):
from collections import Counter
N = int(input())
A = 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):
from itertools import repeat

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

ans = list(repeat(0, n))

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

for e in ans:
    print(e)

Solution (Python):
import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
aint = lambda: int(input())
ints = lambda: list(map(int, input().split()))

n = aint()
a = ints()
c = [0]*n
for i in range(n-1):
    c[a[i]-1]+=1
d = deque(c)
for i in range(n):
    print(d.popleft())

Solution (Python):
import collections
N=int(input())
A_list=list(map(int,input().split()))
c = collections.Counter(A_list)
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 a in A:
    Ans[a - 1] += 1
for ans in Ans:
    print(ans)

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

Solution (Python):
from collections import Counter


def main(N=None, A=None):
    if not N:
        N = int(input())
        A = list(map(int, input().split()))
    count = Counter(A)
    for i in range(1, N+1):
        print(count[i])


if __name__ == "__main__":
    
    
    main()

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

    ans = [0] * n

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

    for a in ans:
        print(a)

Solution (Python):
N = int(input())
arr = list(map(int,input().split()))
dp = [0 for _ in range(N)]

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

for x in dp:
	print(x)

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

for i, a in enumerate(A):
    b[a] += 1

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

Solution (Python):
import numpy as np

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

b=np.zeros(n)

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

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

Solution (Python):
from collections import Counter
n=int(input())

a=[int(x) for x in input().split()]
d=dict(Counter(a))
for i in range(1,n+1):
    if i in d:
        print(d[i])
    else:print(0)

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

subordinates_nums = [0] * n
for a_elem in a:
    subordinates_nums[a_elem - 1] += 1

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

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

Solution (Python):
from collections import Counter

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

s = Counter(a)

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

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

o = [0]*n

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

for j in o:
  print(j)

Solution (Python):
from collections import defaultdict
def C():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = defaultdict(int)
    for i in A:
        ans[i] += 1
    for i in range(N):
        if i+1 in ans:
            print(ans[i+1])
        else:
            print(0)
C()

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()))
staff=[0]*N

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

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

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

num_buf = [0] * n

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

for i in range(len(num_buf)):
    print(num_buf[i])

Solution (Python):
from collections import OrderedDict 
def main():
    n = int(input())
    arr = [int(e) for e in input().split(' ')]
    mp = OrderedDict({k: 0 for k in range(n)})
    for i in range(0, n - 1):
        mp[arr[i] - 1] += 1
    
    for k in mp:
        print(mp[k])

    return 0

if __name__ == "__main__":
    main()

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

for v in A:
    d[v] += 1

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

Solution (Python):
N = int(input())
As = map(int, input().split())
ans = [0]*N
for i in As: ans[i-1] += 1
print("\n".join(map(str,ans)))

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

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

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

for a in ans:
    print(a)

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

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

Solution (Python):
import sys

n = int(sys.stdin.readline())

line = sys.stdin.readline().split()
nums = list(map(int, line))

m = len(nums)

freq = [0] * n

for i in range(m):
    freq[nums[i] - 1] += 1

print('\n'.join([str(x) for x in freq]))

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

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

print(*lst[1::])

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

num_count = collections.Counter(numbers)
for i in range(1, n+1):
    print(num_count[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())
A = list(map(int, input().split()))
V = [[] for _ in range(N)]
for i in range(N - 1):
    V[A[i] - 1].append(i + 2)

for v in V:
    print(len(v))

Solution (Python):
N = int(input())
A = [0, 0, *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_list = list(map(int, input().split()))


ue_list = [0]*N


for i in range(N-1):
    a = a_list[i]
    ue_list[a-1] += 1


for u in ue_list:
    print(u)

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

anslist = [0] * (n+1)

for i in range(len(a)):
  if a[i] > 0:
    anslist[a[i]] += 1

for i in range(1,len(anslist)):
  print(anslist[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 - 1):
  print(ans[i])
print("0")

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

Solution (Python):
from collections import defaultdict, Counter

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

dic = {}

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

for el in a:
    dic[el] += 1

for keys in dic:
    print(dic[keys])

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

subordinates = {}
for a in aa:
    if a not in subordinates:
        subordinates[a] = 1
    else:
        subordinates[a] += 1
for i in range(n):
    if i + 1 in subordinates:
        print(subordinates[i + 1])
    else:
        print('0')

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

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

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

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



if __name__ == "__main__":
    c()

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

for i in range(2, len(A)):
    Buka[A[i]].append(i)

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

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

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
ans = [0]*(N+1)
for Ai in A:
    ans[Ai] += 1
print("\n".join(map(str, ans[1:])))

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

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

for number in A:
    n_under[number - 1] += 1

for n in n_under:
    print(n)

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

ans = [0]*300000

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

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

Solution (Python):
import collections


def main():
    count = int(input())
    lis = list(map(int, input().split()))
    dic = collections.Counter(lis)
    for i in range(1,count + 1):
        if dic[i]:
            print(dic[i])
        else:
            print(0)



if __name__ == '__main__':
    main()

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

Solution (Python):




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

    li = [0]*N

    for a in A:
        li[a-1] += 1
    
    for l in li:
        print(l)


if __name__ == '__main__':
    main()

Solution (Python):
import collections

N = int(input())
A = 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(lambda x:int(x), input().split(" ")))
R = [0 for i in range(N)]

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

for r in R:
    print(r)

Solution (Python):
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n = int(input())
    As = list(map(int, input().split()))
    buka_graph = [[] for _ in range(n)]

    for i in range(n):
        if i==0:
            continue
        ai = As[i-1]

        buka_graph[ai-1].append(i)

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

if __name__ == '__main__':
    main()

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


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

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

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

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

for a in A:
  d[a] += 1
  
for k, v in d.items():
  print(v)

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

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

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

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

for A in As:
    dict[A] += 1

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

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

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


for ai in a:
    d[ai - 1] += 1


for i in d.values():
    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


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

Solution (Python):


import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    a = na()
    ans = [0] * n
    for ai in a:
        ans[ai-1] += 1
    for i in ans:
        print(i)

if __name__ == "__main__":
    main()

Solution (Python):
def resolve():
    '''
    code here
    '''
    import collections

    N = int(input())
    A_list = [int(item) for item in input().split()]

    cnt_dict = collections.Counter(A_list)

    ans = [0 for _ in range(N+1)]
    for i, v in cnt_dict.items():
        ans[i] += v

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

if __name__ == "__main__":
    resolve()

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

data = {str(i):0 for i in range(1, N + 1)}
for A in map(int, input().split()):
    data[str(A)] += 1

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

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):
def main():
	s = int(input())
	a = list(map(int,input().split()))
	l = [0] * s
	for i in range(s-1):
		l[a[i-1]-1] += 1
	print('\n'.join(map(str,l)))
	

if __name__ == '__main__':
	main()

Solution (Python):


def solve():
    N = int(input())
    Alist = list(map(int, input().split()))
    ans = [0]*N

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

    for a in ans:
        print(a)


if __name__ == "__main__":
    solve()

Solution (Python):
n, *a = map(int, open(0).read().split())
bt = [None] + [0] * n

for ai in a:
    bt[ai] += 1

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

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

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

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

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

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

Solution (Python):



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

c = [0]*(N+1)

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

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

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


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

syain=[0 for i in range(len(items)+1)]

for i in items:
    syain[i-1]+=1
for i in syain:
    print(i)

Solution (Python):



def main():
    n = int(input())
    s = [int(s) for s in input().split(" ")]
    buka = {}
    for i in s:
        if i in buka:
            buka[i] += 1
        else:
            buka[i] = 1
    for i in range(n):
        if i + 1 in buka:
            print(buka[i + 1])
        else:
            print("0")


if __name__ == '__main__':
    main()

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

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

for i in range(n):
    print(l[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(0,N):
	print(B[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):
  print(c[i])

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

for i in x:print(i)

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

Solution (Python):
import collections


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

    ans = collections.Counter(A)

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


resolve()

Solution (Python):
from collections import Counter

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

n=int(input())
a=LI()
c=Counter(a)

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

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

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

for i in cnt:
    print(i)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = LIST()

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

    ans.append(0)
    print(*ans,  sep='\n')


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
from collections import Counter
N = int(input())
L = list(map(int, input().split()))
d = Counter() 
d.update(L)

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

Solution (Python):
def main():
    n = int(input())
    a = [int(t)for t in input().split()]
    ans = [0]*n
    for i in range(n-1)[::-1]:
        ans[a[i]] += 1

    for ans_i in ans[1:]:
        print(ans_i)
    print(0)


if __name__ == "__main__":
    main()

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

m = {}
for i in range(1, n+1):
    m[i] = 0
for a in A:
    m[a] += 1
for v in m.values():
    print(v)

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

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()))
Joshi=[0 for i in range(N)]
for a in A:
    Joshi[a-1]+=1
for j in Joshi:
    print(j)

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

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

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

for j in range(N-1):
  a[s[j]-1]+=1
for h in range(N):
  print (a[h])

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

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

buka = [0 for _ in range(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()))

count=[0]*N

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

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

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

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

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

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

b=[]

for i in range(N):
    b.append(0)

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


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

Solution (Python):
from collections import Counter

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

d = Counter(A)

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

Solution (Python):
if __name__ == "__main__":
  n = int(input())
  a_list = [int(i) for i in input().split()]

  ans_list = [0]*n
  for item in a_list:
    ans_list[item-1] += 1

  for i in ans_list:
    print(int(i))

Solution (Python):
import collections

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

c = collections.Counter(data)

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

Solution (Python):
import collections

n, *a = map(int, open(0).read().split())

l = collections.Counter(a)

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

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

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

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

Solution (Python):
N = int(input())
num = {}

for i in range(N):
    num[i] = 0

A = list(map(int, input().split(" ")))
for i in range(len(A)):
    num[A[i]-1] += 1

[print(num[i]) for i in range(N)]

Solution (Python):
import sys, math

n = int(sys.stdin.readline().strip() )
nums = map(int, sys.stdin.readline().split())
infer = [0] * n
for n in nums:
    infer[n-1] += 1
for one in infer:
    print(one)