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 sys
readline = sys.stdin.buffer.readline

import numpy as np

n = int(readline())
a = np.array(readline().split(), np.int32)

a -= 1
ans = np.bincount(a, minlength=n)
print(*ans, sep="\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()))
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()))

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

for ans in cnt:
    print(ans)

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):
import collections


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



AC = collections.Counter(A)



for i in range(1, N+1):
    
    if i in AC:
        print(AC[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):
    print(c[i])

Solution (Python):
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
buka = [0 for i in range(n)]

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

for i in buka:
    print(i)

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

Solution (Python):
import collections

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

AC = collections.Counter(A)
for i in range(1, N+1):
    if i in AC:
        print(AC[i])
    else:
        print(0)

Solution (Python):
n=int(input())
l=[0]*n
for s in input().split():
  l[int(s)-1]+=1
for x in l:
  print(x)

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

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

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

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

K = [0]*N

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

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

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

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

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

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

buka_list = [0] * (n+1)

for a_i in a:
    buka_list[a_i] = buka_list[a_i] + 1

for x in buka_list[1:]:
    print(x)

Solution (Python):
from collections import defaultdict

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

tree = defaultdict(set)
for i, a in enumerate(A, 2):
    tree[a].add(i)
for i in range(1, 1 + N):
    print(len(tree[i]))

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

x = [0]*N

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

for i in x:
    print(i)

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

b = {i + 1:0 for i in range(n)}
for i in a:
    b[i] += 1
c = list(b.items())
c.sort()
for i in range(n):
    print(c[i][1])

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

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 i in c:
		print(c[i])
	else:
		print(0)

Solution (Python):



import sys
input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
x = [0] * int(input())

for i in input().split():
    x[int(i)-1] += 1

print(*x)

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

dict={}

for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
dict[N]=0

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

Solution (Python):
n=int(input())
buka = [0]*n
for joushi in input().split():
  buka[int(joushi)-1] += 1
print(*buka,sep='\n')

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

buka=dict()
for x in a:
    if x not in buka:
        buka[x]=1
    else:
        buka[x]+=1
for i in range(n):
    if (i+1) not in buka:
        print(0)
    else:
        print(buka[i+1])

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

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

A.sort()

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

li = [0]*n

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

for i in li:
    print(i)

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

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

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

A = [-1] + [int(x) - 1 for x in input().split(" ")]

resses = [0] * n

for i in range(1, n):
    resses[A[i]] += 1

for res in resses:
    print(res)

Solution (Python):
import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import Counter

n = ni()
a = na()

c = Counter(a)
ans = [0] * n
for k, v in c.items():
    ans[k - 1] = v

for i in range(n):
    print(ans[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):
import sys
sys.setrecursionlimit(10000000)


dxdy=((1,0),(0,1))

def pin(type=int):
    return map(type,input().rstrip().split())



def resolve():
    N,=pin()
    A=((pin()))
    ans=[0]*N
    for a in A:
        ans[a]+=1
    for v in ans[1:]:
        print(v)
    print(0)

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5
1 1 2 2"""
        output = """2
2
0
0
0"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10
1 1 1 1 1 1 1 1 1"""
        output = """9
0
0
0
0
0
0
0
0
0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """7
1 2 3 4 5 6"""
        output = """1
1
1
1
1
1
0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    

    

    resolve()

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

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

Solution (Python):
n=int(input())
buka = [0]*n
for joushi in input().split():
  buka[int(joushi)-1] += 1
print(*buka,sep='\n')

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):
import collections
n = int(input())
a = [int(x) for x in input().split()]
a = collections.Counter(a)
for i in range(n):
    print(a[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):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    counter = [0] * n
    for a in map(int,input().split()):
        counter[a - 1] += 1
    print(*counter, sep='\n')
resolve()

Solution (Python):
import  collections

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

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

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

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

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

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

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


if __name__ == '__main__':
    solve()

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

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

Solution (Python):
n = int(input())
arr = [int(x) for x in input().split() ]
d = {}

for i,x in enumerate(arr):
	d[x] = d.get(x,0) + 1
    
for i in range(1,n+1):
  print(d.get(i,0))

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
import heapq
import math
import random
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, namedtuple, UserDict
from functools import cmp_to_key, lru_cache, reduce
from itertools import (chain, combinations, combinations_with_replacement,
                       permutations, product)

sys.setrecursionlimit(10**6+1)
write = sys.stdout.write


MOD = 10**9 + 7


if __name__ == "__main__":
    n = int(input())
    arr = [int(ch) for ch in input().split()]
    ans = [0] * (n+1)
    for i in arr:
        ans[i] += 1
    print(*ans[1:], sep='\n')

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

Solution (Python):
c=[0]*int(input())
for q in input().split():c[int(q)-1]+=1
print(*c)

Solution (Python):
import collections

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

c = collections.Counter(A)

i=1

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

Solution (Python):
man = input()
m = input()
master = m.split()
anser = [0 for i in range(int(man))]
for i in range(int(man)-1):
  anser[int(master[i])-1]+=1
for i in range(int(man)):
  print(int(anser[i]))

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

Solution (Python):
n,*a=map(int,open(0).read().split());c=[0]*n
for q in a:c[q-1]+=1
print(*c)

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

Solution (Python):
n,*a=map(int,open(0).read().split());c=[0]*n
for q in a:c[q-1]+=1
for d in c:print(d)

Solution (Python):
from collections import*
n,*a=map(int,open(0).read().split());c=Counter(a)
for i in range(n):print(c[i+1])

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

Solution (Python):
def management(N,array):
  res = [0]*N
  for i in range(len(array)):
    res[array[i]-1] += 1
  for j in range(len(res)):
    print(res[j])

if __name__ == '__main__':
  N = int(input())
  array = list(map(int,input().split()))
  management(N,array)

Solution (Python):

from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math

import collections

N = int(input())
s = input().split()
p = [int(w) for w in s] 

'''
ans_list = [0 for i in range(N)]

for i in range(len(p)):
    ans_list[p[i]-1] += 1

for i in range(N):
    print(ans_list[i])
'''
c = collections.Counter(p)

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

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

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

Solution (Python):



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

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

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 j in range(1,N+1):
    print(ans[j])

Solution (Python):
n=int(input(''))
a= [int(s) for s in input().split(" ")]
t=[0]*(n+1)
for i in range(0,len(a)):
        t[a[i]]+=1
for i in range(1,n+1):
    print(t[i])

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

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

for i in range(2,n+2):
    print(b[i-1])

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

Solution (Python):

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

x=(n+1)*[0]

for i in a:
    x[i]+=1
for i in x[1:]:
    print(i)

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    d = defaultdict(lambda : 0)
    for i in a:
        d[i-1] += 1
    for i in range(n):
        print(d[i])
    return


if __name__ == "__main__":
    solve()

Solution (Python):
from collections import Counter

N = int(input())
ct = Counter(map(int, input().split()))
for i in range(1, N + 1):
    print(ct[i])

Solution (Python):
import math
if __name__ == '__main__':
    N = int(input())
    A = [int(elem) for elem in input().split()]
    count = [0]*N
    for i in A:
      
      
        count[i-1] = count[i-1]+1
    
    [print (i) for i in count]

Solution (Python):
n = int(input())
a = input().split()
 
joshi = {}
 
for i in range(1, n+1):
    joshi[str(i)] = 0
 
for i in range(n-1):
    joshi[a[i]] += 1
 
for ans in joshi.values():
    print(ans)

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

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

for i in N:
    print(i)

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

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

for i in ans:
    print(i)

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
lst=[]
for i in range(n):
    lst.append(0)
for i in a:
    lst[i-1]+=1
for j in lst:
    print(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 = [int(i) for i in input().split()]

ans = [0] * N

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

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

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

Solution (Python):
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
values,counts = zip(*c.most_common())
A = sorted(c.most_common(), key=lambda x: x[0])
A.append([-1])
p = 0
for u in range(N):
    if A[p] != -1:
        if A[p][0] != u+1:
            print(0)
        else :
            print(A[p][1])
            p+=1
    else :
        print(0)

Solution (Python):
n = int(input())
A = [-1, -1] + list(map(int, input().split())) 

cnt = [0] * (n + 1)

for i in range(2, n + 1):
	cnt[A[i]] += 1

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

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

b = [0]* ppap


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

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

Solution (Python):
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,*A = map(int, read().split())

    t = Counter(A)

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


if __name__ == "__main__":
    main()

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

sub=[0]*N

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

for item in sub:
    print(item)

Solution (Python):
n, *A = list(map(int, open(0).read().split()))
B = [0] * n
for a in A:
    B[a-1] += 1
print(*B, sep='\n')

Solution (Python):
from collections import Counter

N = int(input())
ct = Counter(map(int, input().split()))
for i in range(1, N + 1):
    print(ct[i])

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

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

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

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

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

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()))
buka_num=[0 for _ in range(N+1)]

for i in a:
  buka_num[i]+=1
buka_num.pop(0)
for j in buka_num:
  print(j)

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())
li = list(map(int,input().split()))
li.sort(reverse = True)
count = 0
for i in range(1,n+1):
    count = 0
    while True:
        if li:
            if li[-1]==i:
                count+=1
                li.pop()
            else:
                break
        else:
            break
    print(count)

Solution (Python):
import collections

n = int(input())
List = list(map(int, input().split()))
Col = collections.Counter(List)
Col2 = sorted(Col.items())
CountList = [0]*n
for i in Col2:
    CountList[i[0]-1] = i[1]




for i in CountList:
    print(i)

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

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

print(*num)

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

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

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

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

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

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

[print(j) for j in res]

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

c = [0] * N

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

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
li.sort(reverse = True)
count = 0
for i in range(1,n+1):
    count = 0
    while True:
        if li:
            if li[-1]==i:
                count+=1
                li.pop()
            else:
                break
        else:
            break
    print(count)

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

Solution (Python):
from collections import deque
n = int(input())
a_list = deque(sorted(list(map(int, input().split()))))
a = [0 for i in range(n)]
for i in range(n-1):
    a[a_list.popleft()-1] += 1
for i in a:
    print(i)

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

num = [0] * n

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

print(*num)

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

boss_count_list = [0] * n


for val in boss_list:
  boss_count_list[val - 1] += 1

for val in boss_count_list:
  print(val)

Solution (Python):
import numpy as np

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

A.append(0)

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

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

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

for i in range(n):
    print(R[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):
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    n = ni()
    a = nl()

    ans = [0]*n

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

    for value in ans:
        print(value)


if __name__ == '__main__':
    main()

Solution (Python):
num = int(input())
li = list(int(x) for x in input().split())
li2 = [0] * num
num = len(li)
for i in li:
  li2[i - 1] = li2[i - 1] + 1
for j in range(num + 1):
  print(li2[j])

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

result = [0] * N
for i in numbers:
    result[i- 1] += 1
    
for i in range(N-1):
    print(result[i])
print(0)

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

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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Solution (Python):
from collections import Counter

n = int(input())
li = input().split()
a = Counter(li)


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

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

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

    tree = [[] for _ in range(N + 1)]
    for k, a in enumerate(A, 2):
        tree[a].append(k)

    ans = [len(t) for t in tree]
    return ' '.join(map(str, ans[1:]))

print(c_management_tree())

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

    count = Counter(A)
    ans = [count[i] for i in range(1, N + 1)]
    return ' '.join(map(str, ans))

print(c_management())

Solution (Python):

from collections import Counter
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)

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

if __name__ == "__main__":
    resolve()

Solution (Python):
def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  results = [0] * N
  for a in A:
    results[a-1] += 1
  for r in results:
    print(r)

if __name__ == "__main__":
  resolve()

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

Solution (Python):
n = int(input())
A = [int(a) for a in input().split()]
 
sub_list = [0] *n
 
for a in A:
  sub_list[a-1] +=1
 
for i in range(n):
  print(sub_list[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  
for i in range(1, N+1):
  print(ans[i])

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

Solution (Python):
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

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

for i in ans:
    print(i)

Solution (Python):
import collections
import numpy as np

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

zero = np.zeros(n+1)
c = collections.Counter(a)

for val,key in c.items():
    zero[val] = key

for i in range(len(zero)):
    if i > 0:
        print(int(zero[i]))

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

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

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

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

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

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

s = [0]*(n)

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

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

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

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

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

s = [0]*(n)

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

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