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



Sample input:
5
1 1 2 2


Sample output:
2
2
0
0
0

Submission status: Accepted

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

Submission status: Accepted

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

from collections import Counter

cnter = Counter(A)

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

Submission status: Accepted

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

Submission status: Accepted

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

from collections import Counter
S=Counter(A)
#print(S)

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

for ans in a:
  print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np

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

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import collections

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

for i in myList:
    print(i)

Submission status: Accepted

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


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

dic = defaultdict(int)

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

N = int(input())

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

ans = [0] * N

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

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

Submission status: Accepted

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

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

for boss in boss_dict:
    print(boss)

Submission status: Accepted

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

for i in C:
    print(i)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

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

Ss = dict()

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
li = [0] * (n+1)
for i in range(len(a)):
	li[a[i]] += 1
#print(li)
li = li[1:]
print(*li, sep = "\n")

Submission status: Accepted

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

Submission status: Accepted

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

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

for j in boss:
  print(j)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

b =[0]*n

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

for i in b:
    print(i)

Submission status: Accepted

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



    
    

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

Submission status: Accepted

Solution code:
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce

# input = sys.stdin.readline

n = int(input())

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

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

from collections import Counter

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

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

if __name__ == '__main__':
  main()

Submission status: Accepted

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

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

for i in count:
    print(i)

Submission status: Accepted

Solution code:
n = input()
a = input().split()
out = [0] * int(n)

#for i in range( int(n) ):
#    print( a.count(str(i+1)) )

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

for out_i in out:
    print( out_i )

Submission status: Accepted

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

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

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

for i in li:
    print(i)

Submission status: Accepted

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

from collections import Counter

c = Counter(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 21:27:49 2020

@author: arute
"""


from sys import stdin

import time
import numpy as np


############################################

# read data for n sequences.
temp = stdin.readline().split()
N = int(temp[0])

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

data = np.asarray(data)

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

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

print(o)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

A = input().split(" ")

data = []

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

# print(data)

# data[0] += 1

# print(data)

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

# print(data)

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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
a.insert(0,0)
b=[0]*(n)
for i in range(1,n):
    k=a[i]
    b[k-1]+=1
for i in b:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
List = list(map(int,input().split()))
dic = {}
for i in range(n):
  dic[i+1] = 0
for item in List:
  dic[item] += 1
for i in range(n):
  print(dic[i+1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import collections
num = int(input())
line = list(map(int,input().split()))
clist = collections.Counter(line)
for i in range (1,num+1):
    print(clist[i])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

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

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

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

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

	for i in ans:
		print(i)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

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

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)

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

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

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
N = int(input('')) #input()で入力を受け取ってint()で数字型に変換します。

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

A.insert(0,0)

A.insert(0,0)

subordinate = [0] * (N+1)
#subordinate[N-1] = 0

# print(subordinate)
# print(A)

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


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

Submission status: Accepted

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

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

[print(i) for i in Ans]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from pprint import pprint

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

for i in S :
  print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
n = int(input())
s = input().split()
A = [[0] for i in range(n)]
for i in range (n-1):
    j = int(s[i])-1
    A[j] += [1]
for i in range(n):
    print(len(A[i])-1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

for num in result:
    print(num)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in sub:
    print(i)

Submission status: Accepted

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

StaffNumber = [0] * n

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

for i in StaffNumber:
    print(i)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

print("0")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Res = [0] * (N)

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

for res in Res:
    print(res)

Submission status: Accepted

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

d = {}

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

B = [0] * N

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

num = [0] * N

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

for i in num:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = int(input())
ii = list(map(int,input().split()))

import collections

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(A)

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

Submission status: Accepted

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

max_A = max(A)

from collections import Counter

dic = Counter(A)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

for i in employee:
    print(i)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

backet = list([0]*N)
#print(backet)

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

for i in backet:
  print(i)

Submission status: Accepted

Solution code:
from collections import Counter

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

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

Submission status: Accepted

Solution code:
from collections import Counter

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

lis = Counter(A)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
#list from 2 to n
alist=list(map(int,input().split()))

jodic={}

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Counter


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

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


if __name__ == "__main__":
    main()