Problem:
 Score : 300 points    Problem Statement A company has N members, who are assigned ID numbers 1, ..., N .  Every member, except the member numbered 1 , has exactly one immediate boss with a smaller ID number.  When a person X is the immediate boss of a person Y , the person Y is said to be an immediate subordinate of the person X .  You are given the information that the immediate boss of the member numbered i is the member numbered A_i . For each member, find how many immediate subordinates it has.      Constraints  2 \leq N \leq 2 \times 10^5  1 \leq A_i < i         Input Input is given from Standard Input in the following format:  N  A_2  ...  A_N       Output For each of the members numbered 1, 2, ..., N , print the number of immediate subordinates it has, in its own line.        Sample Input 1 5
1 1 2 2      Sample Output 1 2
2
0
0
0  The member numbered 1 has two immediate subordinates: the members numbered 2 and 3 .  The member numbered 2 has two immediate subordinates: the members numbered 4 and 5 .  The members numbered 3 , 4 , and 5 do not have immediate subordinates.       Sample Input 2 10
1 1 1 1 1 1 1 1 1      Sample Output 2 9
0
0
0
0
0
0
0
0
0       Sample Input 3 7
1 2 3 4 5 6      Sample Output 3 1
1
1
1
1
1
0

Solution (Python):
from collections import defaultdict

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

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

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

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

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

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

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

lis = [0]*(N+1)
for a in A:
    lis[a] += 1
for num in lis[1:]:
    print(num)

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

I = [0]*N

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


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

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

arr = [0] * n

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

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

Solution (Python):
def resolve():
    N = int(input())
    array = [0 for i in range(N)]
    buka = [int(i) for i in input().split()]

    for num in buka:
        array[num - 1] += 1
    for i in array:
        print(i)
resolve()

Solution (Python):

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

S = [0] * N 

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

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

Solution (Python):






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

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

    for c in C:
        print(c)

main()

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

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

a.sort()

tmp=0
cnt=0

for bangou in range(1,n+1):
    if tmp<len(a):
        while a[tmp]==bangou:
            cnt+=1
            tmp+=1
            if tmp==len(a):
                break
    print(cnt)
    cnt=0

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

menber = [0]*n

for value in a:
    menber[value-1] += 1
    
for i in menber:
    print(i)

Solution (Python):


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

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

for s in S:
  print(s)

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

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re












import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
dic = defaultdict(int)
for i in range(n):
    dic[i+1] = 0
for a in A:
    dic[a] += 1
for i in range(n):
    print(dic[i+1])

Solution (Python):
import sys
from collections import Counter

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
ac = Counter(inl())


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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)
ans = [ctr[i+1] for i in range(N)]
print(*ans, sep='\n')

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.insert(0,0)
C = {i:0 for i in range(1,N+1)}
for i in range(2,N+1):
    a = A[i]
    C[a] += 1
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()))
c = Counter(A)
for i in range(N):
  print(c[i+1])

Solution (Python):
from collections import Counter
n = int(input())
A = Counter(list(map(int, input().split())))
ans = [0] * n
for x,y in A.items():
    ans[x-1] = y
for i in ans: print(i)

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

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

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

for i in buka:
    print(i)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
g = [[] for _ in range(n)]

for i in range(n - 1):
    g[a[i] - 1].append(i)

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

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

staff_count_list = [0] * N

for i in A_list:
    staff_count_list[i - 1] += 1
for i in staff_count_list:
    print(i)

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

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

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

Solution (Python):

import sys
input=sys.stdin.readline
import collections

def main():
    bosses=[]
    count={}
    n = int(input())
    bosses=list(map(int,input().split()))
    ans=[0]*n
    for i in bosses:
        ans[i-1]+=1

    for a in ans:
        print(a)

if __name__=="__main__":
    main()

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

n = int(input().strip())
dp = [0] * (n+1)
A = [int(i) for i in input().strip().split()]

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

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

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

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

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

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

for i in ans_li:
  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 i in b:
  print(i)

Solution (Python):
import collections

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

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

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

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

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

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

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

Solution (Python):
from collections import  Counter

N = int(input())

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

C = Counter(A)

for i in range(1, N+1):
    print(C.get(i,0))

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

c=collections.Counter(b)
n,m=zip(*c.most_common())
n,m=list(n),list(m)
o=c.most_common()

result=[0]*a
for i in range(len(o)):
    result[o[i][0]-1]=o[i][1]

for i in result:
    print(i)

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

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

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

Solution (Python):
N = int(input())
num = [0] * (3 * 10 ** 5)
A = list(map(int,input().split()))
for i in range(len(A)):
	num[A[i]] += 1
for i in range(1,N + 1):
	print(num[i])

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

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

for b in B:
  print(b)

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

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

num = [0]*(n+1)

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

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

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


boss = [int(i) - 1 for i in input().split()]

sub = { i: 0 for i in range(n) }
for b in boss:
  sub[b] += 1

for m in range(n):
  print(sub[m])

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.keys():
        print(Ac[i])
    else:
        print(0)

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
d = {i:[] for i in range(1,n+1)}
for i,num in enumerate(a):
    d[num].append(i+2)
ans = []
for i in range(1,n+1):
    ans.append(len(d[i]))
write("\n".join(map(str, ans)))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

buka = [0]*N

for p in range(N-1):
    buka[A[p] -1] += 1

for q in range(N):
    print(buka[q])

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

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

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

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

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

result = [0] * N
for a in A:
    result[a - 1] += 1
print('\n'.join(map(str, result)))

Solution (Python):
n,*a=map(int,open(0).read().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):
def main():
  a = int(input())
  b =[0]*a
  
  for c in map(int, input().split()):
    b[c-1] += 1
    
  print('\n'.join(map(str, b)))
 
main()

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

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

Solution (Python):
import collections
N = int(input())
A = [int(_) for _ in input().split()]
cnt = collections.defaultdict(int)
for a in A:
    cnt[a] += 1
for i in range(1, N + 1):
    print(cnt[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]+=1
for i in range(n):
    print(s[i])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
subs = [[] for _ in range(N)]
for i, a in enumerate(A):
    subs[a - 1].append(i)

for i in range(N):
    print(len(subs[i]))

Solution (Python):
import collections

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

c = collections.Counter(A)

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

print(0)

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

ans = [0]*n

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

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

import collections

c = collections.Counter(a) 


for k in range(1,n+1):
    try: 
        print(c[k])
    except:
        print(0)

Solution (Python):

"""
Created on Sun Jul  5 00:00:01 2020

@author: Aruto Hosaka
"""

import collections

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

C = collections.Counter(A)

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

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

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

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

for mng in a:
    sub[mng] += 1

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

Solution (Python):
from collections import Counter

n=int(input())
lst=Counter(list(map(int,input().split())))
for i in range(1,n+1):
    if i in lst : print(lst[i])
    else : print(0)

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

Solution (Python):
import numpy as np



N = int(input())

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

ans = np.zeros(N)

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

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

Solution (Python):

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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


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

    tree = [list() for i in range(N)]
    for i in range(N - 1):
        tree[A[i] - 1].append(i + 1)

    for i in range(N):
        print(len(tree[i]))


def main():
    solve()


if __name__ == '__main__':
    main()

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

n, d = int(input()), defaultdict(int)
s = list(map(int, input().split()))
for i in s: d[i] += 1
for i in range(1, n + 1): print(d[i])

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    A = LI()
    sub = [0]*n
    for a in A:
        sub[a-1] += 1
    for s in sub:
        print(s)

if __name__ == '__main__':
    main()

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

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


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

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

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]] += 1
ans.pop(0)
for j in range(n):
	print(ans[j])

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

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

Solution (Python):
from collections import Counter

N = int(input())

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def solve():
    N = II()
    A = LI()

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

    printlist(P, '\n')

if __name__ == '__main__':
    solve()

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

l = [0 for _ in range(n+1)]
for i in a:
    l[int(i)]+=1

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

Solution (Python):
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

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


def solve():
    n = ri()
    L = [0] * (n + 1)
    for i in rl():
        L[i] += 1

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






mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()

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 range(N-1) :
    ans[A[i]-1] += 1

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

Solution (Python):

n, *a = map(int, open(0).read().split())
b = [0] * n
for i in a:
    b[i - 1] += 1
print(*b, sep="\n")

Solution (Python):
from collections import Counter

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

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

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

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

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

Solution (Python):



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

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

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

diff = [0] * n

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

for j in diff:
    print(j)

Solution (Python):
from collections import defaultdict
n = int(input())
a = [int(i) for i in input().split()]
mapping = defaultdict(int)
for _a, i in zip(range(2, n + 1), a):
  mapping[i] += 1
for i in range(1, n + 1):
  print(mapping[i])

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

list_ = [0]*n
joshi_list = list(map(int, input().split()))[::-1]

for i,num in enumerate(joshi_list):
  list_[num-1]+=1

for num in list_:
  print(num)

Solution (Python):
import sys
from collections import Counter


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    cnt = Counter(a)
    for i in range(1, n + 1):
        print(cnt[i])


if __name__ == '__main__':
    main()

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

Solution (Python):
import collections

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


ac = collections.Counter(a)

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

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

B=Counter(A)


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

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

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

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

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

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

ans=[0]*n

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

for j in ans:
    print(j)

Solution (Python):
import numpy as np
N=int(input())
A=input().split()
n=np.zeros(N)

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

Solution (Python):
import collections 

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

c = collections.Counter(a)

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

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

for i in (a):
  sub_list[i - 1] += 1

for i in range(n):
  print(sub_list[i], sep = ',')

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

result = [0] * (N + 1)

for i in list(map(int, input().split())):
    result[i] += 1

result.pop(0)

for r in result:
    print(r)

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

y = collections.Counter(x)

for i in range(1, len(x)+2):
  print(y[i], end = "\n")

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

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

ans = [0] * n

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

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

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

counter = [0 for i in range(n)]
A = list(map(int, input().split()))

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

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

Solution (Python):
import sys

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

ans = [0] * n

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

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

Solution (Python):
import sys

n = int(input())
A = list(map(int, sys.stdin.readline().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()))

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

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 v in range(n):
    print(b[v]);

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

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

for i in ans:
    print(i)

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

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

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

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

c = collections.Counter(l)


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

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

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

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

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

Solution (Python):
import sys
def main():
    N=int(sys.stdin.readline())
    A=tuple(map(int,sys.stdin.readline().split()))
    R=[0 for _ in range(N)]
    for a in A:R[a-1]+=1
    for r in R:print(r)
if __name__=='__main__':main()

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

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


for a in ans:
    print(a)

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

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

print(0)

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

import collections
A_count = collections.Counter(A)

keys = A_count.keys()

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

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

man_list=[0]*N

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

print(*man_list)

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

man=1
cnt=0
man_list=[0]*N

A.sort()
A += [0]

for a in A:
  if a != man:
    man_list[man-1] = cnt
    man = a
    cnt=0
  cnt+=1

print(*man_list)

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

man=1
cnt=0
man_list=[0]*N
A.sort()
A += [0]

for a in A:
  if a != man:
    man_list[man-1] = cnt
    man = a
    cnt=0
  cnt+=1

for l in man_list:
  print(l)

Solution (Python):
def main():
    N = input_int()
    A = input_int_list_in_line()
    A = [-1, -1] + A

    num_buka = [0] * (N+1)

    for i in range(2, len(A)):
        num_buka[A[i]] += 1

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


def input_int():
    return int(input())


def input_ints():
    return map(int, input().split())


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


def input_int_tuple_list(n: int, q: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()

Solution (Python):
def main():
    N = input_int()
    A = input_int_list_in_line()
    A = [-1, -1] + A

    num_buka = [0] * (N+1)

    for i in range(2, len(A)):
        num_buka[A[i]] += 1

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


def input_int():
    return int(input())


def input_ints():
    return map(int, input().split())


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


def input_int_tuple_list(n: int, q: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()

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

cnt = {}
for i in a:
    cnt.setdefault(i, 0)
    cnt[i] += 1

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

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

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

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

for i in range(N-1):
    ans[a[i]-1].append(i+2)
for i in range(N):
    print(len(ans[i]))

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

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

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()

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

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

for i in ans:
  print(i)

Solution (Python):
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
A = ri_()
B = [0] * N
for Ai in A:
    B[Ai - 1] += 1
for Bi in B:
    print(Bi)

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

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

from collections import defaultdict


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


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

for me in memo.values():
    print(me)

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

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

buka = [0]*N

for a in range(N-1):
    buka[A[a]-1] += 1

for a in range(N):
    print(buka[a])