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())
dicti = {}
boss = list(map(int, input().split()))
for i in boss:
    if i in dicti:
        dicti[i] += 1
    else:
        dicti[i] = 1

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

Solution (Python):
import numpy
N = int( input())
a = list(map(int, input().split(' ')))
l = [0]*N
numpy.sort(a)
for i in a:
    l[i-1] += 1
for i in l:
    print(i)

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

result = collections.Counter(a)

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

Solution (Python):
n=int(input())
boss=[int(x) for x in input().split()]
mem=list(range(1, n+1))
h_map = dict.fromkeys(mem, 0)
for i in boss:
  h_map[i]+=1
for i in mem:
  print(h_map[i])

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

res = [0] * n
for l in li:
  res[l-1] += 1

for r in res:
  print(r)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
k = [0] * (n + 1)
for i in a: k[i] += 1
print(*k[1 : n + 1], 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] += 1
print(*ans, sep="\n")

Solution (Python):
import numpy as np
n = int(input())
jousi = list(map(int, input().split()))
a = np.zeros(n)
for i in range(len(jousi)) :
    a[jousi[i] - 1] += 1
for i in range(len(a)):
    print(int(a[i]))

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N = I()
A = LI()

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

for i, value in enumerate(a):
    b[value-1] += 1

for j in b:
    print(j) 

print('0')

Solution (Python):
import numpy as np
 
 
if __name__ == '__main__':
    List = [list(map(int, input().split())) for i in range(2)]
    N = List[0][0]
    buka = np.array(List[1][:])
 
 
    l_out = np.zeros(N,dtype=int)
 
    for i in range(N-1):
        l_out[buka[i]-1] += 1
 
    for i in range(N):
        print(l_out[i])

Solution (Python):
N = int(input())
A = input().split()
senior = [0]*N

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

for s in senior:
    print(s)

Solution (Python):
import collections

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

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

Solution (Python):
import collections

n=int(input())
a = [int(_) for _ in 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()))

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

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

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

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

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

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

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

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

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

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

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

[print(j) for j in B]

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

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

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

Solution (Python):
def get_subordinate(n, members):
    new_dict = {}

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

    for member in members:
        if member in new_dict:
            new_dict[member] += 1

    print(*new_dict.values(), sep="\n")


if __name__ == '__main__':
    n = int(input())
    members = list(map(int, input().rstrip().split()))
    get_subordinate(n, members)

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







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

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

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

rsl = np.zeros(n)

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

for i in range(n):
    print(int(rsl[i]))

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

Solution (Python):
def function(n, list1):
  ans = [0] * n
  for i in list1:
    ans[i - 1] += 1
  string = ""
  for i in range(len(ans)):
    if i < len(ans) - 1:
      string += str(ans[i]) + "\n"
    else:
      string += str(ans[i])
  return string
 
n = int(input())
list1 = input().split()
list1 = [int(i) for i in list1]
print(function(n, list1))

Solution (Python):
import numpy as np

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

dst = np.zeros(n)
for i in range(n-1):
	dst[int(a[i])-1] += 1

for i in range(n):
	print(int(dst[i]))

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

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

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

Solution (Python):
import collections


member_cnt = int(input())
bosses = input().split(' ')
boss_dict = collections.Counter(bosses)

for i in range(1, member_cnt + 1):
  print(boss_dict.get(str(i), 0))

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

list = []
for i in range(0, N + 1):
    list.append(0)
for i in range(0, N - 1):
    a = P[i]
    list[a] += 1
for i in range(1, N + 1):
    print(list[i])

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

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

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

dic = {str(num):0 for num in range(1, n + 1)}

for a in As:
    dic[str(a)] += 1

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

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

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

Solution (Python):

import sys


def solve(N: int, A: "List[int]"):
    d = [int()]*N

    for x in A:
        d[x-1]+=1
    [print(d_) for d_ in d]

    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):
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
l = [str(0) for i in range(n)]
key = list(c.keys())
for i in range(len(list(c.keys()))):
    l[key[i]-1] = str(c[key[i]])
print('\n'.join(l))

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

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

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

    print('\n'.join(map(str,ans)))
    
if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np
N=int(input())
A_np = np.zeros(N)
A=list(map(int, input().split()))
for Ai in A:
  A_np[Ai-1] = A_np[Ai-1] + 1
for i in range(N):
  print('{:.0f}'.format(A_np[i]))

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

boss = {}
boss[0] = 0
for i, v in enumerate(M):
  boss[i+1] = 0
  boss[v-1] += 1

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

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

l=[0]*N

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

for e in l:
    print(e)

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

num = [0]*a

def mi(x):

    
    return int(x-1)

y = list(map(mi,lists))

for i in range(a-1):
    num[y[i]] += 1
for i in range(a):
    print(num[i])

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

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

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

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

    print('\n'.join(map(str,ans)))
    
if __name__ == "__main__":
    main()

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

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

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

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

Solution (Python):
n = int(input())
m = input().split()
m = [int(i) for i in m]
 
l =[]
for i in range(n):
  l.append(0)
for i in m:
  ind = i-1
  l[ind] += 1
for i in l:
  print(i)

Solution (Python):
import collections

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

if __name__ == "__main__":
    N = int(input())
    A = dict(collections.Counter(LI()))
    for i in range(1, N+1):
        count = A.get(i)
        print(count if count is not None else 0)

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

dic = {}
for i in range(n):
    dic[i] = 0
for i in range(len(a)):
    a[i] -= 1
    dic[a[i]] += 1
dic = sorted(dic.items())

for item in dic:
    first, second = item
    print(second)

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

Solution (Python):
from collections import Counter

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  collection = Counter(A)
  for i in range(1, N + 1):
    print(collection[i])
  
  

if __name__ == "__main__":
  resolve()

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

import collections

c = collections.Counter(a_list)
[print(c[i+1]) for i in range(n)]

Solution (Python):
from collections import Counter

N = int(input())
A = [int(x) for x in input().split()]
a = Counter(A)

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

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
num = int(readline().rstrip())
arr = list(map(int,readline().rstrip().split()))
dic = {}
for i in arr:
    if i in dic:
        dic[i] +=1
    else:
        dic[i]=1
print(dic[1])
for j in range(2,num+1):
    if j in dic:
        print(dic[j])
    else:
        print('0')

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

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

x = len(c)

lst = [0]*n

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

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

Solution (Python):
import collections

n= int(input())
li=list(map(int,input().split()))
c=collections.Counter(li)

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

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 a in ANS:
    print(a)

Solution (Python):
import collections

N=int(input())

A=input().split()

c=collections.Counter(A)
result=[]

for i in range(1,N+1):
    result.append(c[str(i)])

for r in result:
    print(r)

Solution (Python):
from sys import stdin
import numpy as np
N=list(map(int,(stdin.readline().strip().split())))[0]
A=list(map(int,(stdin.readline().strip().split())))
num_list=[0]*N
moji=A[0]
i=0
length=len(A)-1
for i in A:
    num_list[i-1]+=1
for num in num_list:
    print(num)

Solution (Python):
employeeCount = int(input())
directBosses = list(map(int, input().split()))
directJuniorCounts = [0] * employeeCount

for boss in directBosses:
    directJuniorCounts[boss - 1] += 1

for jc in directJuniorCounts:
    print(jc)

Solution (Python):
N = int(input())
a_list = [i for i in input().split()]
result = [0 for i in range(1, N+1)]

for i in a_list:
    result[int(i)-1] += 1

for a in result:
    print(a)

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

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

c = Counter(arr)

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 a:
    ans[i-1] += 1

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

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

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

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

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

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

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


counter = dict()
for i in A:
    if i not in counter.keys():
        counter[i] = 1
    else:
        counter[i]+=1

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

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

Solution (Python):
import math
def main():
    N = int(input())
    l = [int(_) for _ in input().split()]
    count_list = [0] * N
    for i in l:
        index = i - 1
        count_list[index] += 1

    for out in count_list:
        print(out)
main()

Solution (Python):
import collections
from collections import Counter
n=int(input())
d=collections.deque()
l=list(map(int,input().split()))
d.extend(l)
d.appendleft(0)
c=dict(Counter(d))
s=set(d)
for x in range(1,len(d)+1):
    if x in s:
        print(c[x])
    else:
        print(0)

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

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

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

print("0")

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

Solution (Python):

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







count= [0] * N

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

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

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

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

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

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

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

    for i in ans:
        print(i)
    

if __name__ == "__main__":
    main()

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

a.sort()

lis = [0] * n
m = 1

for i in range(0, n-1):
    while a[i] > m:
        m += 1
    lis[m-1] += 1
    
for i in range(n):
    print(lis[i])

Solution (Python):
N = int(input())
l = list(map(int, input().split()))
l.append('END')
ans = l.copy()
for i in range(len(l)):
    ans[i] = 0
try:
    for i in range(len(l)):
        ans[l[i] - 1] += 1
except TypeError:
    pass
for i in ans:
    print(i)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
l=[]
for i in range(len(a)+2):
  l.append(0)
  
for i in a:
  if(l[i]==0):
  	l[i]=1
  else:
    l[i] += 1

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

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

List1 = [int(a) for a in input().split(" ")]
List2 = [0]*N

for x in List1:
  List2[x-1] = List2[x-1] + 1
  
for y in List2:
  print(y)

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

la.append(N+1)

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

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

Solution (Python):
n, = tuple(int(s) for s in input().split())
arr = list(int(s) for s in input().split())

import collections
cc = collections.defaultdict(set)
for i, x in enumerate(arr):
    cc[x].add(i)

for x in range(1, n+1):
    print(len(cc[x]))

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

mydict = {}
for i in range(N):
    mydict[i] = 0


for i in range(len(a)):
    if M-a[i] <= N:
        mydict[a[i]-1] += 1 
        N -= 1
        M -= a[i]

for i in range(W):
    print(mydict[i])

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




import collections
c = collections.Counter(boss_list)

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

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

Solution (Python):


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

shain = [0] * n

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

print(*shain)

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

B = [0] * N

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

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

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

Solution (Python):










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

    b = dict.fromkeys(range(1, N + 1), 0)

    for i, a in enumerate(A, 1):
        b[a] += 1
    
    for bb in b.values():
        print(bb)

if __name__ == "__main__":
    main()

Solution (Python):
import collections

n = int(input())
mentors = input().split(" ")

a = collections.Counter(mentors)

for i in range(1, n+1):
    if str(i) in a.keys():
        print(a[str(i)])
    else:
        print(0)

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

B=sorted(A)

def histogram_sorted(data):
    table = []
    prev = data[0] 
    c = 1
    for i in range(1,len(data)):
        if prev == data[i]:
            c=c+1
        else:
            table.append([prev,c])
            prev = data[i]
            c = 1
    table.append([prev,c])
    return table

X = histogram_sorted(B)

X.append([0,0])

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

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

bossNums=[]

for i in range(Num):
  bossNums.append(0)


for i in range(Num-1):
  bossNums[bossNumsList[i]-1] += 1

for i in range(Num):
  print(bossNums[i])

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

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

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

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

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

n = int(n)

sort_a = sorted(a)


buka = []
boss_num = 1
buka_count = 0

i = 0
while boss_num < n:
    if i > n-2 and boss_num < n:
        buka.append(buka_count)
        buka_count = 0
        boss_num = boss_num + 1
    elif boss_num == sort_a[i]:
        buka_count = buka_count + 1
        i = i + 1
    elif boss_num != sort_a[i] and i <= n-2:
        buka.append(buka_count)
        boss_num = boss_num + 1
        buka_count = 0

buka.append(0)

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

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

emp_num = [0] * N

for j in range(N-1):
    emp_num[A[j]-1] += 1

for k in range(N):
    print(emp_num[k])

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A.sort(key=int)
l=0
for i in range(N):
    c=0
    while l < len(A) and A[l] == i+1:
        l+=1
        c+=1
    print(c)

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

Solution (Python):
import collections
N = input()
l = input().split()
c = collections.Counter(l)

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

Solution (Python):
import collections

n = input()
n = int(n)
alist = input().split(" ")
intalist = [int(s) for s in alist]
setalist = list(set(intalist))

c = collections.Counter(intalist)

result = [0] * n
if n == 1:
    print(0)
else:
    for i in range(0,n):
        try:
            result[setalist[i] - 1] = c[setalist[i]]
            
        except IndexError:
            pass
for i in range(0,n):
    print(result[i])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = 1
count = 0
for i in a:
    if i == c:
        count += 1
    else:
        print(count)
        if i-c-1 > 0:
            for _ in range(i-c-1):
                print(0)
        c = i
        count = 1
print(count)
for _ in range(n-a[-1]):
    print(0)

Solution (Python):
def q3():
    from collections import deque
    N = int(input())
    A = deque([int(i) for i in input().split()])
    ans = [0]*N
    for a in A:
        ans[a-1] += 1
    for i in ans:
        print(i)


if __name__ == '__main__':
    q3()

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

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

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

del number[0]
number.append(0)
for Answer in number:
  print(Answer)

Solution (Python):

N = int(input())
sub = [0]*(N+1)


for bossi in map(int, input().split()):
    sub[bossi] = sub[bossi]+1

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

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

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

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

Solution (Python):
worker_num=int(input())
num_director=input().split()
count_director=[]
for j in range(len(num_director)+1):
    count_director.append(int(0))

for i in num_director:
    count_director[int(i)-1] +=1

for out in count_director:
    print(out)

Solution (Python):
import collections
N = int(input())
A = [0]
A.extend(list(map(int, input().split())))
c = collections.Counter(A)
buka_num = []

for i in range(1,N):
    buka_num.append(c[i])
    
buka_num.append(0)
for ele in buka_num:
    print(ele)

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

followId = list(map(int, input().split(" ")))

followCounter = [0] * numOfWorker

for id in followId:
    followCounter[id - 1] += 1

for value in followCounter:
    print(value)

Solution (Python):
N=int(input())
A=[int(x) for x in input().split()]
R=[0 for _ in range(N)]
for i in range(N-1):
  j=A[i]-1
  R[j]=R[j]+1
for x in R:print(x)

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A.sort()
indexA=0
A.append(N+10)
for x in range(N):
  check=1
  countA=0
  while check==1:
    if A[indexA]!=x+1:
      check=0
      countA-=1
      indexA-=1
    indexA+=1
    countA+=1
  print(countA)

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

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

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

for ans in ans_list:
    print(ans)

Solution (Python):

def CountFrequency(my_list,n): 
  
    
    freq = {}
    for  i in range(1,n+1):
    	freq[i]=0

    for item in my_list: 
        if (item in freq): 
            freq[item] += 1
        else: 
            freq[item] = 1
  
    for key, value in freq.items(): 
        print (value)
  

if __name__ == "__main__":  
    n=int(input())
    l=list(map(int,input().split())) 
  
    CountFrequency(l,n)

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

for i in range (len(k)):
    x[(k[(i)]-1)] += 1

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

Solution (Python):
import collections
N=int(input())
A=[int(x) for x in input().split()]
A_1=collections.Counter(A)
i=0
if 2<=N<=2*10**5:
    for i in range(0,N-1):
        if 0<=i<=N-2:
            if 1<=A[i]<i+2:
                j=i+1
                print(A_1[j])
                i+=1
        if i==N-1:
            print(0)

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

tb = [0] * n

for x in arr:
    tb[x - 1] += 1
    
for t in tb:
    print(t)

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

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

result_list_str = [str(i) for i in result_list]
print('\n'.join(result_list_str))

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

for i in subs:
	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
del ans[0]
ans.append(A.count(N))
for i in range(N):
  print(ans[i])

Solution (Python):
import bisect

man_count = int(input())

infos = [int(i) for i in input().split()]
infos.sort()

next_num = 0
end = 0
for i in range(len(infos)+1):
    if i != next_num:
        print(0)
        continue

    
    start = bisect.bisect_right(infos, i+1, end)  
    print(start - end)
    end = start

    
    if start == len(infos):
      next_num = infos[start-1] -1
    else:
      next_num = infos[start] -1

Solution (Python):
size = int(input())
li = list(map(int,input().split()))
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    print(i)

Solution (Python):
import collections

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

Solution (Python):
people = int(input()) - 1
boss = input().split(' ')
boss = list(map(int,boss))
dict_boss = {}
for i in range(people):
	if boss[i]-1 not in dict_boss:
		dict_boss[boss[i]-1] = 1
	else:
		dict_boss[boss[i]-1] += 1
boss = [0] * (people + 1)
for key in dict_boss:
	boss[key] = dict_boss[key]
for i in boss:
	print(i)

Solution (Python):
tmp = input().split(" ")
N = int(tmp[0])
tmp = input().split(" ")
A = [int(i) for i in tmp]
nofb = [0]*N
for i in range(N,1,-1):
  
  boss = A[i-2]
  nofb[boss-1] += 1
for i in range(N):
  print(nofb[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

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

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

Solution (Python):

N = int(input())
A = list(map(int, input().split()))
Votes = [0] * N
for i in range(1, N+1):
    if i != 1:
        Votes[A[i-2]-1] += 1
print(*Votes, sep="\n")

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

def format_input(filename = None):
	global n
	global a
	if filename == None:
		n = int(input())
		a = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(2, 2 * 10**5)
		a = [rng(1, i) for i in range(1, n)]
		print(n)
		print(' '.join(list(map(str, a))))

def get_answer():
	count = [0] * (n+1)
	for i in a:
		count[i] += 1
	for i in range(1, n+1):
		print(count[i])

if __name__ == '__main__':
	format_input()

	get_answer()