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 math

class abc_163:
    
    def __init__(self):
        pass
    
    def A(self):
        r=int(input())
        print(2*math.pi*r)
    
    def B(self):
        NM=list(map(int,input().split()))
        A=list(map(int,input().split()))
        
        if NM[0]-sum(A)>=0:print(NM[0]-sum(A))
        else:print("-1")
    
    def C(self):
        N=int(input())
        A=list(map(int,input().split()))
        ans_list=[0]*(N+1)
        
        for i in range(N-1):ans_list[A[i]] +=1
        for i in range(1,N+1):print(ans_list[i])
    
if __name__=='__main__':
    obj=abc_163()
    obj.C()

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

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

from collections import Counter

cnter = Counter(A)

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

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

s = dict.fromkeys([int(n) for n in range(1,n+1)], 0)

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

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

Solution (Python):
N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
    
l = [0]*N
for a in A:
    l[a-1]+=1
for sl in l:print(sl)

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

from collections import Counter
S=Counter(A)


a=[0]*N
for x, v in S.items():
  a[x-1] += v

for ans in a:
  print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

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

if __name__ == '__main__':
    main()

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

Solution (Python):
import numpy as np

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

b = np.zeros(shape=(n), dtype=np.int)

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

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
j=0
c=0
import sys
a.sort()

for i in range(1,n+1):
    while 1:
        if j==n-1:
            
            break
        if i!=a[j]:
            break
        else:
            c+=1
            j+=1
    print(c)
    c=0

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

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

Solution (Python):
import numpy as np

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

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

for i in range(N-1):
  a[A[i]].append(1)

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

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

A.sort()
for i in range(1, A[0]):
    print(0)

idx = 0
for shain in range(A[0], N+1):
    num = 0
    while True:
        if idx >= N - 1:
            print(num)
            num = 0
            break
        if shain != A[idx]:
            print(num)
            num = 0
            shain += 1
            break
        else:
            num += 1
            idx += 1

Solution (Python):
import collections

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

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

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

Solution (Python):
import math

n = int(input())
l = list(map(int, input().split()))
d = {}
for e in l:
    if e in d:
        d[e] += 1
    else:
        d[e] = 1

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

Solution (Python):
myList = []
for i in range(int(input())):
    myList.append(0)
for i in input().split():
    myList[int(i)-1]=myList[int(i)-1]+1

for i in myList:
    print(i)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict


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

dic = defaultdict(int)

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

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

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

a.sort()
li = [0] * n
for i in a:
    li[i - 1] += 1
for i in range(n):
    print(li[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 range(len(ans)): 
    print(ans[i])

Solution (Python):
N = int(input())
numbers = input().strip().split(' ')

boss_dict = [0] * N
for i in range(N - 1):
    boss_num = int(numbers[i])
    boss_dict[boss_num - 1] += 1

for boss in boss_dict:
    print(boss)

Solution (Python):

N = int(input())
A = list(map(int, input().split()))
C = [0 for i in range(N)]
A.sort()
i = 0
while i < N - 1:
    C[A[i] - 1] = C[A[i] - 1] + 1
    i += 1

for i in C:
    print(i)

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

a.sort()
tn = 1
cnt = 0
suffix = 0
for i in range(n):
    for j in range(suffix, n-1):
        if a[j] == tn:
            cnt += 1
            suffix = j+1
        else:
            break
    print(cnt)
    cnt = 0
    tn += 1

Solution (Python):



import math

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

Ss = dict()

for i in range(1, N):
    a = As[i-1] - 1
    if (a in Ss):
        Ss[a] += 1
    else:
        Ss[a] = 1

for i in range(0, N):
    if (i in Ss):
        print(Ss[i])
    else:
        print(0)

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

li = li[1:]
print(*li, sep = "\n")

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

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

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

for j in boss:
  print(j)

Solution (Python):
n = int(input())
dicti = dict({})
for i in range(1,n+1):
    dicti.update({i : 0})
arr = list(map(int,input().split()))
for x in arr:
    a = dicti[x]
    dicti.update({x : a+1})
for i in range(1,n+1):
    print(dicti[i])

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

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

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

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

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

for i in Ai:
    Az[i-1] += 1
for j in Az:
    print(j)

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

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

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

b =[0]*n

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

for i in b:
    print(i)

Solution (Python):
import sys
input = sys.stdin.readline
import itertools
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [1, 1, 2, 2])
    2
    2
    0
    0
    0
    >>> print_ans(10, [1,1,1,1,1,1,1,1,1])
    9
    0
    0
    0
    0
    0
    0
    0
    0
    0
    >>> print_ans(7, [1,2,3,4,5,6])
    1
    1
    1
    1
    1
    1
    0
    """
    ans_list = [0] * N
    gr = itertools.groupby(sorted(ar))
    for key, group in gr:
        ans_list[key-1] = (len(list(group)))
    for ans in ans_list:
        print(ans)
    
    



    
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int, input().rstrip().split()))
    print_ans(N, ar)

Solution (Python):
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce



n = int(input())

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

a_n = np.array(a)
cnt_np = np.zeros(n)

for an in a:
    cnt_np[an-1] += 1
for cnt in cnt_np:
    print(int(cnt))

Solution (Python):
def main():
  n = int(input())
  A = [int(x) for x in input().split()]
  
  a_dict = {}

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

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

  for i in range(n):
    print(a_dict[i+1])
  
if __name__ == "__main__":
    main()
    pass

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

from collections import Counter

def main():
  N = int(input())
  bosses = tuple(map(int, input().split()))

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

if __name__ == '__main__':
  main()

Solution (Python):
n = int(input())
tmp = input()
a = [int(s) for s in tmp.split()]
count = [0] * n

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

for i in count:
    print(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 = input()
a = input().split()
out = [0] * int(n)




for a_i in a:
    a_i = int(a_i)
    out[a_i-1] += 1

for out_i in out:
    print( out_i )

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

li =[0]*(len(iplist) + 1)

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

for i in li:
    print(i)

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

from collections import Counter

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()))
acou = Counter(a)
for i in range(1,n+1):
    print(acou[i])

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

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

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

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

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

if __name__ == "__main__":
    main()

Solution (Python):
import collections

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

C = collections.Counter(A)
for i in range(1, n+1):
  print(C[i])

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

Solution (Python):

"""
Created on Sun Apr 19 21:27:49 2020

@author: arute
"""


from sys import stdin

import time
import numpy as np





temp = stdin.readline().split()
N = int(temp[0])

data = []
write = stdin.readline().split()
for i in range(N-1):
    data.append(int(write[i]))

data = np.asarray(data)

out = np.zeros(N)
for d in data:
    out[d-1] += 1

o = ""
for l in out:
    o+=str(int(l))+"\n"

print(o)

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

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

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.append(0)
num = 0
tem = 1
ans = [0]*n
for i in a:
  if i != tem:
    ans[tem-1] = num
    tem = i
    num = 1
  else:
    num += 1
for i in ans:
  print(i)

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

A = input().split(" ")

data = []

for i in range(0, len(A)):
    data.append(0)







for i in A:
    data[int(i) - 1] += 1



for i in data:
    print(i)
print(0)

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

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

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

Solution (Python):
from collections import Counter

n = int(input())
a_list = list(map(int, input().split(" ")))
buka_count = Counter(a_list)

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

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

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

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

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

Solution (Python):


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

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

























def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007




def main():
	N = inputInt()
	A = inputList()

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

	for i in ans:
		print(i)





def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res


def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y



def H(n, r, mod=10**9+7):
	
	
    return combination(n+r-1, r, mod)

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        
        
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()

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

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

A.insert(0,0)

A.insert(0,0)

subordinate = [0] * (N+1)





for index in range(N, 1, -1):
    subordinate[A[index]] = subordinate[A[index]] + 1


for index in range(1, N+1, 1):
    print(subordinate[index])

Solution (Python):
Syain_num = int(input())
Joshi = input().rstrip().split(' ')
Ans = [0] * Syain_num

for i in range(Syain_num-1):
   Ans[int(Joshi[i])-1] = Ans[int(Joshi[i])-1] + 1

[print(i) for i in Ans]

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

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

Solution (Python):
import sys
from pprint import pprint

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

ans = [0 for _ in range(N)]
for a_i in A:
    ans[a_i-1] += 1
            
print("\n".join(map(str, ans)))

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

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

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

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

S = [ 0 for i in range(R) ]

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

for i in S :
  print(i)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
n,a,i=1,0,0
while i<N-1:
    if A[i]==n:
        a+=1
        i+=1
        continue
    print(a)
    a=0
    n+=1
print(a)
m=N-n
for i in range(m):
    print(0)

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

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

Solution (Python):
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())
s = input().split()
A = [[0] for i in range(n)]
for i in range (n-1):
    j = int(s[i])-1
    A[j] += [1]
for i in range(n):
    print(len(A[i])-1)

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

Solution (Python):
n=int(input())
a=[int(x) for x in input().split()]
ans=[0]*n

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

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

Solution (Python):
param_n = int(input())
params1 = list(map(lambda x: int(x), input().split(' ')))

result = [0 for i in range(param_n)]

for employee in params1:
    result[employee - 1] += 1

for num in result:
    print(num)

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

for a in list_A:
    B[a-1] += 1

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

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

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

for i in sub:
    print(i)

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

StaffNumber = [0] * n

for i in BossNumber:
    StaffNumber[i-1] += 1

for i in StaffNumber:
    print(i)

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

l = [0 for _ in range(0, N)]

for a in AS:
    l[a-1] += 1

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

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

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

print("0")

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

buka = [0]*N

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

for b in buka:
    print(b)

Solution (Python):
from sys import stdin

members = int(stdin.readline().rstrip())
answers = [0] * members
for x in stdin.readline().rstrip().split():
  answers[int(x) - 1] += 1
  
for a in answers:
  print(a)

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

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

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

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

Res = [0] * (N)

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

for res in Res:
    print(res)

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

d = {}

for i in a:
    if not i in d.keys():
        d[i] = 1
        continue
    d[i] += 1

for j in range(1, n+1):
    if not j in d.keys():
        print(0)
    else:
        print(d[j])

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

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

for n in range(len(num)):
    print(num[n])

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

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

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

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

ind=a[0]-1
prev=a[0]
a=a[1:]
count_list=[0]*n
count_list=[0]*n
count=1

for i,x in enumerate(a):
  if(x==prev):
    count+=1
    
  else:
    count_list[ind]=count
    ind=x-1
    prev=x
    count=1
    
count_list[ind]=count

for count in count_list:
  print(count,end=' ')

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

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

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

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

B = [0] * N

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

for j in B:
    print(str(j))

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

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

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

num = [0] * N

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

for i in num:
    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):
i = int(input())
ii = list(map(int,input().split()))

import collections

c = collections.Counter(ii)
k = list(c.keys())

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

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

count =[0 for i in range(N)]
for i in range(N-1):
    count[A_n[i] - 1] +=1
for j in range(N):
    print(count[j])

Solution (Python):
from collections import defaultdict
nb_people = int(input())
immediates = [int(x) for x in input().split()]
bosses = defaultdict(list)
emp_id  = 0
for i in immediates:
    bosses[i].append(emp_id)
    emp_id += 1
for i in range(1, nb_people+1):
    if i in bosses:
        print(len(bosses[i]))
    else:
        print("0")

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

for i in lst:
  print(i)

Solution (Python):
import collections

N = int(input())
A = input().split()

c = collections.Counter(A)

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

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

max_A = max(A)

from collections import Counter

dic = Counter(A)

for i in range(1, max_A + 1):
    print(dic[i])

for i in range(max_A + 1, N+1):
    print(0)

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

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

employee = list(A)
employee.append(0)

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

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

for i in employee:
    print(i)

Solution (Python):
from collections import defaultdict
n = int(input())
l = list(map(int, input().split()))
d = defaultdict(int)
for i in l:
    d[i] += 1

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

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

intAList = [int(i) for i in A]

backet = list([0]*N)


for i in intAList:
  backet[i-1] += 1

for i in backet:
  print(i)

Solution (Python):
from collections import Counter

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

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

Solution (Python):
from collections import Counter

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

lis = Counter(A)

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

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

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

for l in B.values():
    print(l)

Solution (Python):

def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = []
    for _ in range(N):
        ans.append(0)
    for i in A:
        ans[i-1]+=1
    for j in ans:
        print(j)
if __name__ == '__main__':
    main()

Solution (Python):
import collections
N = int(input())
A =[int(a) for a in input().split()]
def f():
    d = collections.defaultdict(int)
    for i, e in enumerate(A):
        d[e] += 1
    for key in range(1, N+1):
        print(d[key])
f()

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

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

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

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

jodic={}

for i in alist:
    if i in jodic:
        jodic[i]=jodic[i]+1
    else:
        jodic[i]=1

for j in range(n):
    if j+1 in jodic:
        print(jodic[j+1])
    else:
        print("0")

Solution (Python):


from collections import Counter


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

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


if __name__ == "__main__":
    main()

Solution (Python):
import collections

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

Solution (Python):

a=int(input())
b=input().split()

count = []
for i in range(a):
    count.append(0)
    
for i in range(len(b)):
    n = int(b[i]) -1
    count[n] += 1

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

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

Solution (Python):
n = int(input())
all = list(map(int,input().split()))
result ={}
for i in range(n):
    result[i] = 0

for i in all:
    result[i-1] += 1


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

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

C = collections.Counter(A)

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

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

for _ in a:
  if b.get(_, "NotFound") == "NotFound" :
    b[_] = 1
  else:
    b[_] += 1

for i in range(1,n+1):
  if b.get(i, "NotFound") == "NotFound" :
    print(0)
  else:
    print(b[i])

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

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

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

for sub in subordinates:
    print(sub)

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

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

for num in num_sub:
    print(num)

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

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

for i in range(N-1):
    if A[i] != 0:
        M[A[i]-1]+=1
        
for i in range(N):
    print(M[i])

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

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

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

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

Solution (Python):
import collections

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

count_a = collections.Counter(a_list)

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

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

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

line = input().rstrip().split(' ')
a = [0] * n

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

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

Solution (Python):

import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)

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

def main():
    n = int(input())
    la = list(map(int, input().split()))

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

if __name__ == '__main__':
    main()

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

if __name__ == '__main__':
  main()