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())
A = list(map(int, input().split()))
B = [0]*(N+1)
for i in A:
    B[i] += 1
print('\n'.join(list(map(str, B[1:]))))

Solution (Python):



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

Solution (Python):
n=int(input())
a=[int(x) for x in 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):
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
a = inl()
ans = [0] * n
for i in a:
    ans[i-1] += 1
out(ans)

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

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

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

main()

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

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

Solution (Python):
import collections

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


if __name__ == '__main__':
    main()

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

d = {}

for a in A :
    d.setdefault(a,0)
    d[a] += 1


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

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

Solution (Python):
import collections

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

c = collections.Counter(a_array)

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

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

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

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

for j in a:
  print(j)

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

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

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

member_list = [0]*N
for rel in rel_list:
    member_list[rel-1] += 1

[print(i) for i in member_list]

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

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

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

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

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

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

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

for j in b:
    print(j)

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

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

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

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

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

for a in an:  
  print(a)

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

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

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

Solution (Python):












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


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

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

Solution (Python):


n=int(input())
a=list(map(int,input().split()))
li=[0]*n

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

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

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

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

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

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

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):
n=int(input())
a=list(map(int,input().split()))
import collections
cnt=collections.Counter(a)

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

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

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

counter = [0] * num_employees

for boss in bosses:
    counter[boss - 1] += 1

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

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

for i in N_List.values():
    print(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):
nn = int(input())
aa = list(map(int,input().split()))

joushi = [0]*nn

for i in range(len(aa)):
    joushi[aa[i]-1] += 1

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

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

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

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

Solution (Python):
import bisect
N = int(input())
A = [int(x) for x in input().split()]
A=sorted(A)
index = 0
for i in range(1, N+1):
    now = bisect.bisect_right(A, i)
    print(now - index)
    index = now

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

Solution (Python):
n=int(input())
s=[0]*((2*(10**5))+1)
a=list(map(int,input().split()))

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

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

for i in ans.values():
  print(i)

Solution (Python):
import collections

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

for i in range(1,len(A)+2):
    print(a[i])

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

subordinate = {}
for b in boss:
    subordinate[b] = subordinate.get(b, 0) + 1

for i in range(1, n+1):
    print(subordinate.get(i, 0))

Solution (Python):
N = int(input())
A = list(map(lambda a: int(a), input().split(" ")))
A.sort()

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

print("\n".join([str(s) for s in S]))

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
ans = [0 for i in range(N)]
for i in range(0,N-1):
  ans[A[i]-1] += 1
print(*ans, sep='\n')

Solution (Python):

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

Solution (Python):
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    counter = {}
    for num in A:
        counter[num] = counter.get(num, 0) + 1
    for i in range(1, N+1):
        print(counter.get(i, 0))

if __name__ == "__main__":
    solve()

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

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

for j in num:
    print(j)

Solution (Python):
from collections import Counter

n = int(input())
s = map(int, input().split(" "))
data = Counter(s)
for i in range(1, n+1):
    print(data.get(i, 0))

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

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

for b in B:
    print(b)

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

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

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

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

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

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

B=[0]*N

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

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

Solution (Python):

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import collections

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

ans = collections.Counter(A)

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

Solution (Python):
import collections

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

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

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

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

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

Solution (Python):
import collections
N=int(input())
A=[x for x in input().split()]
c = collections.Counter(A)
for i in range(N):
	print(c["{}".format(str(i+1))])

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

print('\n'.join([str(i) for i in subords]))

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

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

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

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

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

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

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

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

for j in range(n):
    print(ans[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 b in B:
	print(b)

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import pi
def main():
    n, *a = map(int, read().split())
    cnt = [0] * n
    for ae in a:
        cnt[ae-1] += 1
    print(*cnt, sep='\n')

if __name__ == '__main__':
    main()

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

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

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

Boss = [int(x) for x in input().split()]
kind_of_Boss = collections.Counter(Boss)

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

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

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

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

Solution (Python):

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

ans = [0] * (N + 1)
for v in X:
    ans[v] += 1

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

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

buka = [0] * (n+1)
for i in a:
    buka[i] += 1

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

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

s=[0]*N
for i in A:
    s[i-1]+=1
for t in s:
    print(t)

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

import bisect

for i in range(1,N+1):
    print(bisect.bisect_right(A,i)-bisect.bisect_left(A,i))

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

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
D = {c:0 for c in range(N)}
for a in A:
  D[a-1] += 1
for d in D.values():
  print(d)

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

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

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

Solution (Python):

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

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

def main(n,a):
    buka=[0]*(n+1)
    for i in range(n-1):
        buka[a[i]]+=1
    return buka[1:n+1]

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    for i in range(n):
        print(ans[i])

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

for z in range(n):
    print(R[z])

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

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

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

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

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

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

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


if __name__ == '__main__':
    main()

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

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

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

ans = [0]*n

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

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

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

ans = [0]*n

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

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

result = [0] * N

for n in A:
    result[n - 1] += 1

for r in result:
    print(r)

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

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

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

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

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

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

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

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

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

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

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

A.sort()
ans = [0] * N
m = -1

for i in range(N-1):
    if i == N-2:
        ans[A[i]-1] = i - m
    elif A[i] != A[i+1]:
        ans[A[i]-1] = i - m
        m = i
for i in range(N):
    print(ans[i])

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

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

[print(i) for i in list]

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    buka_num_arr = [0] * N
    joshi_idx_arr = list(map(int,input().split()))
    for joshi_idx in joshi_idx_arr:
        buka_num_arr[joshi_idx-1] += 1
    for i in range(N):
        print(buka_num_arr[i])

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

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

Solution (Python):
import sys


def resolve(in_, out):
    n = int(in_.readline())
    b = [0] * (n + 1)
    for a in map(int, in_.readline().split()):
        b[a] += 1
    out.write('\n'.join(map(str, b[1:])))


def main():
    resolve(sys.stdin.buffer, sys.stdout)


if __name__ == '__main__':
    main()

Solution (Python):
import collections
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
c = collections.Counter(a)
l = [0]*n
for i,x in c.items():
    l[i-1] = x
    
for i in l:
    print(i)

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

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

ans = [0]*(N+1)

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

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

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

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
a = inpl()
ans = [0] * n

for i in range(n-1,0,-1):
    ans[a[i - 1] - 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 i in range(n - 1):
    if a[i] > 0:
        l[a[i] - 1] += 1

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

Solution (Python):


def main():

    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)


if __name__ == "__main__":
    main()

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

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


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

  dic = defaultdict(int)
  for i, a in enumerate(A):
    dic[a] += 1

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


if(__name__ == '__main__'):
  main()

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

for i in range(N-1):
  boss.append(0)
  boss[int(A[i])-1] += 1

for i in range(N):
  print(str(boss[i]))

Solution (Python):







































































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    
    N = int(lines[0])
    
    values = list(map(int, lines[1].split()))
    
    
    
    
    
    
    

    results = [0] * N

    for value in values:
        results[value-1] += 1

    return results



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5', '1 1 2 2']
        lines_export = [2, 2, 0, 0, 0]
    if pattern == 2:
        lines_input = ['10', '1 1 1 1 1 1 1 1 1']
        lines_export = [9, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    if pattern == 3:
        lines_input = ['7', '1 2 3 4 5 6']
        lines_export = [1, 1, 1, 1, 1, 1, 0]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



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

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


def main():
    n = int(readline().rstrip())
    aList = sorted(list(map(int, readline().rstrip().split())))
    z = [0] * n
    for a in aList:
        z[a-1] += 1

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


if __name__ == '__main__':
    main()

Solution (Python):


from typing import *
import collections
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, A: "List[int]"):
    c = collections.Counter(A)
    return "\n".join([f'{c[i+1]}' for i in range(N)])


def main():

    sys.setrecursionlimit(10 ** 6)

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


if __name__ == '__main__':
    main()

Solution (Python):


from typing import *
import collections
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, A: "List[int]"):
    c = collections.Counter(A+[i+1 for i in range(N)])
    return "\n".join([f'{c[i+1]-1}' for i in range(N)])


def main():

    sys.setrecursionlimit(10 ** 6)

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


if __name__ == '__main__':
    main()

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

m = Counter(a)

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

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

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

for i in ans:
  print(i)

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

Solution (Python):
n = int(input())
d = dict(zip([i for i in range(1, n + 1)], [0] * n))
l = map(int, input().split())
for i in l:
    d[i] += 1
for i in d.values():
    print(i)

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

Solution (Python):
from sys import stdin
import sys, math

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

a = [0 for i in range(n)]
d = [int(x) for x in stdin.readline().rstrip().split()]

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

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

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

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

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

Solution (Python):
from collections import Counter

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

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

A2N = list(map(int, input().split()))
import collections
c = collections.Counter(A2N)
for i in range(1, N):
    if i in c.keys():
        print(c[i])
    else:
        print(0)
print(0)

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

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

result = { i + 1: 0 for i in range(N) }

for ai in an:
    result[ai] += 1

for r in result.values():
    print(r)

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

boss = [[] for _ in range(n)]

for i,j in enumerate(a):
    boss[j-1].append(i)

for i in boss:
    print(len(i))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

lis = [0]*N
for a in As:
    lis[a-1]+= 1

for l in lis:
    print(l)

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

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

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

Solution (Python):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
subordinates = [0] * N
boss_and_cnt = Counter(A)
for boss, cnt in boss_and_cnt.items():
  subordinates[boss - 1] = cnt
for s in subordinates:
  print(s)

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

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

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

if __name__ == "__main__":
  resolve()

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

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

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

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

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

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

ans = [0] * n

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

for i in ans:
    print(i)

Solution (Python):
N = int(input())
A = map(lambda x: x - 1, map(int, input().split()))
B = [0] * N
for a in A:
    B[a] += 1
print('\n'.join(map(str, B)))