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

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

ins=[0]*N
for l in L:
    ins[l]+=1

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

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

ans = [0]*n

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

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

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

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

Solution (Python):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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(len(cnt)):
    print(cnt[i])

Solution (Python):
from collections import defaultdict

N, = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
graph = defaultdict(list)
for i, x in enumerate(A, 2):
    graph[x].append(i)
for i in range(1, N + 1):
    print(len(graph[i]))

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

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

memo = [0]*n

for i in t:
    memo[i-1] += 1

for j in memo:
    print(j)

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

ans = [0] * N

for i in range(len(l)):
    ans[l[i] - 1] += 1

for i in ans:
    print(i)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(int(1E+7))
N = int(input())
A = list( map(int,input().split()))
cnt = [0] * N
for a in A:
    cnt[a-1]+=1
for n in range(N):
    print (cnt[n])

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

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

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

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

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

res = [0]*N
for a in A:
    res[a-1] += 1
print(*res, sep='\n')

Solution (Python):

import sys


def solve(N: int, A: "List[int]"):
    b = [0] * N
    for a in A:
        b[a-1] += 1
    return b



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N - 2 + 1)]  
    print(*solve(N, A), sep='\n')

if __name__ == '__main__':
    main()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

n = INT()
a = LIST()
b = set(a)
c = Counter(a)
for i in range(1, n + 1):
    if not i in b:
        print(0)
    else:
        print(c[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):
from sys import stdin
input = stdin.readline

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

cnt = [0] * N

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

for c in cnt:
    print(c)

Solution (Python):
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
    D[a] += 1

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

Solution (Python):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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

for c in counts[1:]:
    print(c)

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): 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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]




N = ii()
A = li()

l = [0]*N

for num in A:
    l[num-1] += 1

for a in l:
    print(a)

Solution (Python):
import numpy as np
import math
from collections import defaultdict

d = defaultdict(int)

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

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

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

Solution (Python):














mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

def main():
    n = int(input())
    a = readInt()
    m = {}
    for x in a:
        if x in m.keys():
            m[x] += 1
        else:
            m[x] = 1
    for i in range(1,n+1):
        if i in m.keys():
            print(m[i])
        else:
            print(0)
    return

if __name__=='__main__':
    main()

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

G = [[] for _ in [0]*N]

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

for g in G:
    print(len(g))

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

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

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

for s in S:
    print(s)

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

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):
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())
count = [0] * n

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

for child, parent in enumerate(A, 1):
    count[parent-1] += 1

for c in count:
    print(c)

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

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

Solution (Python):
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right,insort_left,insort_right
from heapq import heapify,heappop,heappush
from copy import deepcopy
from itertools import accumulate,groupby,permutations,combinations
from math import ceil,sqrt,cos,sin,pi,gcd

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

cnt = [0] * N

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

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

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):
n = int(input())

arr = [int(x) for x in input().split(" ")]

a = [0]*n

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

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

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

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

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

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

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
l = [0]*n
for i in a:
    l[i - 1] += 1
for i in range(n):
    print(l[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):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



def main():
    N = I()
    A = LI()
    m = defaultdict(int)

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

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




if __name__ == '__main__':
    main()

Solution (Python):

N = int(input())

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

lis = [0] * N

for i in range(N-1):

    lis[A[i]-1] += 1

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

Solution (Python):
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

n = load()
A = load_list()

d = defaultdict(int)

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

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

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

Solution (Python):
import sys


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


def main():
    N = int(input())
    A = list(map(int, input().split()))
    check = [0 for _ in range(N)]
    for a in A:
        check[a - 1] += 1
    for c in check:
        print(c)


if __name__ == "__main__":
    main()

Solution (Python):

"""
Created on Sun Apr 19 20:41:16 2020

@author: Kanaru Sato
"""

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

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

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

Solution (Python):
from collections import Counter
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)
    ans = []
    for i in range(1,N+1):
        if i in C:
            ans.append(C[i])
        else:
            ans.append(0)
    return ans
print(*solve(),sep='\n')

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

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

N = int(readline().strip())

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

ans = [0] * N

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

for a in ans:
    print(a)

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

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

Solution (Python):
from collections import Counter

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

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

ans = [0] * N

for i in range(len(l)):
    ans[l[i] - 1] += 1

for i in ans:
    print(i)

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

Solution (Python):

import sys


def solve(N: int, A: "List[int]"):
    G = [[] for _ in range(N)]
    for i, a in enumerate(A):
        G[a-1].append(i+1)
    for g in G:
        print(len(g))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N - 2 + 1)]  
    solve(N, A)

if __name__ == '__main__':
    main()

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

Solution (Python):
MOD = 10 ** 9 + 7
INF = 10 ** 12
import sys
sys.setrecursionlimit(1000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  itertools import permutations

def main():
    n = int(input())
    a = list(map(int,input().split()))
    
    dic = {i:0 for i in range(n)}
    for num in a:
        dic[num - 1] += 1
    
    for i in dic:
        print(dic[i])
   

if __name__ =='__main__':
    main()

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

count = [0]*N
for elem in A:
    count[elem-1] += 1
for c in count:
    print(c)

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











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    ans = [0]*N
    for a in A:
        ans[a-1]+=1
    print(*ans,sep="\n")
if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

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

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

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

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

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

for si in subordinate:
    print(si)

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

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

Solution (Python):



def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    
    from collections import Counter

    def dump(*args):
        sys.stderr.write(str(args))

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    count = [0]*N
    A = list(map(int,input().split()))
    for a in A:
        count[a-1] += 1
    for c in count:
        print(c)

if __name__ == "__main__":
    main()

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

nums=[0]*(N+1)
for i in range(N-1):
    nums[A[i]]+=1
    
print(*nums[1:], sep='\n')

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

N = int(input())
A = [0] + list(map(int, input().split()))
ans = [0] * (N+1)
for a in A[::-1]:
    ans[a] += 1
print(*ans[1:], sep='\n')

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

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))
    d = {}
    for i, a in enumerate(A):
        if a in d.keys():
            d[a] += 1
        else:
            d[a] = 1

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


if __name__ == '__main__':
    main()

Solution (Python):


def main():
    n = int(input())
    a = list(map(int, input().split()))
    so = [0 for i in range(n)]
    for i in range(n - 1):
        j = a[i]
        so[j - 1] += 1
    for s in so:
        print(s)

if __name__ == "__main__":
    main()

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

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

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

for i in range(2,N+1):
    C[A[i]].append(i)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.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

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

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

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

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

Solution (Python):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
output_ = np.zeros(N)
for A_ in A:
    output_[A_ - 1] += 1
for o_ in output_:
    print(int(o_))

Solution (Python):
def main():
    import sys
    from collections import defaultdict
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    N = int(input())
    A = [int(x) for x in input().strip().split()]
    D = defaultdict(int)
    for a in A:
        D[a] += 1
    
    for n in range(1, N+1):
        print(D[n])

if __name__ == '__main__':
    main()

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [0] * N
    for a in A:
        B[a-1] += 1
    print("\n".join(map(str, B)))

    return 0

if __name__ == "__main__":
    solve()

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

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

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

Solution (Python):
n = int(input())
lis = [0 for _ in range(n)]

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

for i in lis:
    print(i)

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
res = [0] * N
for x in a: res[x - 1] += 1
for r in res: print(r)

Solution (Python):
from collections import defaultdict
d = defaultdict(int)

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

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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
cnt = Counter(a)

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

Solution (Python):

import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
from math import gcd
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def lcm(a,b):return (a*b) // gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')
def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
A = iln()

cnt = collections.Counter(A)

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

Solution (Python):
from collections import Counter

n = int(input())
c = Counter(int(x) for x in input().split())
for i in range(1, n + 1):
    print(c[i])

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

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

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

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

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

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

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


if __name__ == '__main__':
    resolve()

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

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

print(*cnt[1:], sep='\n')

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

d = dict(zip(range(1, N+1), [0]*N))
for a in A:
    d[a] += 1

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

Solution (Python):
import sys
from collections import defaultdict

read = sys.stdin.read
readline = sys.stdin.readline

N, *A = map(int, read().split())
cnt = defaultdict(int)
for i in A:
    cnt[i] += 1

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

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

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

ans=[0]*n

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

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

Solution (Python):
def main():
    N = int( input())
    A = list( map( int, input().split()))
    B = [0]*(N+1)
    for a in A:
        B[a] += 1
    print("\n".join( map( str, B[1:])))
if __name__ == '__main__':
    main()

Solution (Python):
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

N = Int()
A = IntList()

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

Solution (Python):
from collections import defaultdict
N=int(input())
a_list=list(map(int,input().split()))
par=defaultdict(int)
for a in a_list:
    par[a-1]+=1

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

Solution (Python):
from collections import defaultdict
n = int(input())
dd = defaultdict(int)
A=[int(i) for i in input().split()]

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

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

Solution (Python):

import sys


def solve(N: int, A: "List[int]"):
    boss = [0] * N
    for i in range(len(A)):
        boss[A[i]-1]+=1
    for b in boss:
        print(b)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N - 2 + 1)]  
    solve(N, A)

if __name__ == '__main__':
    main()

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):
n = int(input())

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

l = [0] * (n)

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

for _l in l:
    print(_l)

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

Solution (Python):
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

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

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