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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t = int(input())
A = list(map(int,input().split()))
B = [0]*t
for i in range(t-1):
    B[A[i]-1] += 1
for i in range(t):
    if B[i]!= -1:
      print(B[i]) 
    else:
      print(0)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = [0]*n
c_a = Counter(a)
c_a_v = c_a.items()

for i, j in c_a_v:
    cnt[i-1] = j

for k in cnt:
    print(k)

Submission status: Accepted

Solution code:
import math
import queue

def readInt():
	return int(input())

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

def readChars():
	return input().split()


x = readInt()

a = readInts()

r = [0]*x

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

for i in range(len(a)+1):
	print(r[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = [0]*n

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


dic = {}
for s in a:
    if not (s in dic):
        dic[s] = 1
    else:
        dic[s] += 1


for i in range(n):
    if not(i+1 in dic):
        print(0)
    else:
        print(dic[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())
A = [0] + list(map(int, input().split()))

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

for ansi in ans[1:]:
    print(ansi)

Submission status: Accepted

Solution code:
n = int(input(''))
alist = input('').split(' ')

h = {}
for i in range(1,n):
    a = int(alist[i-1])
    if not a in h.keys():
        h[a]=0
    h[a]+=1

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
x = {}
for i in a:
    x[i]=x.get(i,0)+1
for i in range(n):
    if (i+1) in x:
        print(x[i+1])
    else:
        print(0)

Submission status: Accepted

Solution code:
n=int(input())
arr=list(map(int,input().strip().split()))[:n-1]
dict1={}
for i in arr:
	if i in dict1:
		dict1[i]+=1
	else:
		dict1[i]=1
for i in range(1,n+1):
	if i in dict1:
		print(dict1[i])
	else:
		print(0)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))

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

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

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter

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

c = Counter(A)
for i in range(1, N + 1):
    print(c.get(i, 0))

Submission status: Accepted

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

tmp_lst = [0]*(n+1)

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    joushi = list(map(int,input().split()))
    lst = [0] * n
    for i,j in enumerate(joushi):
        lst[j-1] += 1

    for n in lst:
        print(n)

main()

Submission status: Accepted

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

mem_dict = {i:[] for i in range(1, n+1)}
for i, boss in enumerate(a_list):
  mem_dict[boss].append(i)
  
for v in mem_dict.values():
  print(len(v))

Submission status: Accepted

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

for i in range(n - 1):
    relation_list[a_list[i] - 1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import repeat

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

ans = list(repeat(0, n))

for e in nums:
    ans[e - 1] += 1

for e in ans:
    print(e)

Submission status: Accepted

Solution code:
import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
aint = lambda: int(input())
ints = lambda: list(map(int, input().split()))

n = aint()
a = ints()
c = [0]*n
for i in range(n-1):
    c[a[i]-1]+=1
d = deque(c)
for i in range(n):
    print(d.popleft())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter


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


if __name__ == "__main__":
    # main(5, [1, 1, 2, 2])
    # main(10, [1, 1, 1, 1, 1, 1, 1, 1, 1])
    main()

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    ans = [0] * n

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

    for a in ans:
        print(a)

Submission status: Accepted

Solution code:
N = int(input())
arr = list(map(int,input().split()))
dp = [0 for _ in range(N)]

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

for x in dp:
	print(x)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

b=np.zeros(n)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
n=int(input())
#d=defaultdict(int)
a=[int(x) for x in input().split()]
d=dict(Counter(a))
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 = list(map(int, input().split()))

subordinates_nums = [0] * n
for a_elem in a:
    subordinates_nums[a_elem - 1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]

s = Counter(a)

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

Submission status: Accepted

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

o = [0]*n

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

for j in o:
  print(j)

Submission status: Accepted

Solution code:
from collections import defaultdict
def C():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = defaultdict(int)
    for i in A:
        ans[i] += 1
    for i in range(N):
        if i+1 in ans:
            print(ans[i+1])
        else:
            print(0)
C()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

num_buf = [0] * n

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

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

Submission status: Accepted

Solution code:
from collections import OrderedDict 
def main():
    n = int(input())
    arr = [int(e) for e in input().split(' ')]
    mp = OrderedDict({k: 0 for k in range(n)})
    for i in range(0, n - 1):
        mp[arr[i] - 1] += 1
    
    for k in mp:
        print(mp[k])

    return 0

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
As = map(int, input().split())
ans = [0]*N
for i in As: ans[i-1] += 1
print("\n".join(map(str,ans)))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(n)-1 for n in input().split()]

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

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

for a in ans:
    print(a)

Submission status: Accepted

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

sub = [0] * (N + 1)
for i in range(0, len(A)):
    sub[A[i]] += 1
for i in range(1, N + 1):
    print(sub[i])

Submission status: Accepted

Solution code:
import sys

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

line = sys.stdin.readline().split()
nums = list(map(int, line))

m = len(nums)

freq = [0] * n

for i in range(m):
    freq[nums[i] - 1] += 1

print('\n'.join([str(x) for x in freq]))

Submission status: Accepted

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

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

print(*lst[1::])

Submission status: Accepted

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

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

Submission status: Accepted

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

res=[0]*N

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

for i in res:
    print(i)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
V = [[] for _ in range(N)]
for i in range(N - 1):
    V[A[i] - 1].append(i + 2)

for v in V:
    print(len(v))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem C - management

# input
N = int(input())
a_list = list(map(int, input().split()))

# initialization
ue_list = [0]*N

# ue loop
for i in range(N-1):
    a = a_list[i]
    ue_list[a-1] += 1

# output
for u in ue_list:
    print(u)

Submission status: Accepted

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

anslist = [0] * (n+1)

for i in range(len(a)):
  if a[i] > 0:
    anslist[a[i]] += 1

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

Submission status: Accepted

Solution code:
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 - 1):
  print(ans[i])
print("0")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter

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

dic = {}

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

for el in a:
    dic[el] += 1

for keys in dic:
    print(dic[keys])

Submission status: Accepted

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

subordinates = {}
for a in aa:
    if a not in subordinates:
        subordinates[a] = 1
    else:
        subordinates[a] += 1
for i in range(n):
    if i + 1 in subordinates:
        print(subordinates[i + 1])
    else:
        print('0')

Submission status: Accepted

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

Submission status: Accepted

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

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

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


##########
if __name__ == "__main__":
    c()

Submission status: Accepted

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

for i in range(2, len(A)):
    Buka[A[i]].append(i)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for number in A:
    n_under[number - 1] += 1

for n in n_under:
    print(n)

Submission status: Accepted

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

ans = [0]*300000

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

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

Submission status: Accepted

Solution code:
import collections


def main():
    count = int(input())
    lis = list(map(int, input().split()))
    dic = collections.Counter(lis)
    for i in range(1,count + 1):
        if dic[i]:
            print(dic[i])
        else:
            print(0)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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


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

    li = [0]*N

    for a in A:
        li[a-1] += 1
    
    for l in li:
        print(l)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(A)

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(lambda x:int(x), input().split(" ")))
R = [0 for i in range(N)]

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

for r in R:
    print(r)

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n = int(input())
    As = list(map(int, input().split()))
    buka_graph = [[] for _ in range(n)]

    for i in range(n):
        if i==0:
            continue
        ai = As[i-1]

        buka_graph[ai-1].append(i)

    for i in range(n):
        print(len(buka_graph[i]))
        # print(buka_graph[i])
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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


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

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

Submission status: Accepted

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

d = {i:0 for i in range(1, n+1)}

for a in A:
  d[a] += 1
  
for k, v in d.items():
  print(v)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
As = [int(n) for n in input().split()]

dict = {}
for i in range(1,N+1):
    dict[i] = 0

for A in As:
    dict[A] += 1

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

Submission status: Accepted

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

d = {}
for i in range(n):
        d[i] = 0
# print(d)

for ai in a:
    d[ai - 1] += 1
# print(d.values())

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

Submission status: Accepted

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

ans = [0]*n

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


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

Submission status: Accepted

Solution code:
#create date: 2020-04-19 21:04

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    a = na()
    ans = [0] * n
    for ai in a:
        ans[ai-1] += 1
    for i in ans:
        print(i)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    import collections

    N = int(input())
    A_list = [int(item) for item in input().split()]

    cnt_dict = collections.Counter(A_list)

    ans = [0 for _ in range(N+1)]
    for i, v in cnt_dict.items():
        ans[i] += v

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())

data = {str(i):0 for i in range(1, N + 1)}
for A in map(int, input().split()):
    data[str(A)] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
	s = int(input())
	a = list(map(int,input().split()))
	l = [0] * s
	for i in range(s-1):
		l[a[i-1]-1] += 1
	print('\n'.join(map(str,l)))
	

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:


def solve():
    N = int(input())
    Alist = list(map(int, input().split()))
    ans = [0]*N

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

    for a in ans:
        print(a)


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n, *a = map(int, open(0).read().split())
bt = [None] + [0] * n

for ai in a:
    bt[ai] += 1

for a in bt[1:]:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

c = [0]*(N+1)

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

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

Submission status: Accepted

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

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

syain=[0 for i in range(len(items)+1)]

for i in items:
    syain[i-1]+=1
for i in syain:
    print(i)

Submission status: Accepted

Solution code:
#


def main():
    n = int(input())
    s = [int(s) for s in input().split(" ")]
    buka = {}
    for i in s:
        if i in buka:
            buka[i] += 1
        else:
            buka[i] = 1
    for i in range(n):
        if i + 1 in buka:
            print(buka[i + 1])
        else:
            print("0")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in x:print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections


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

    ans = collections.Counter(A)

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


resolve()

Submission status: Accepted

Solution code:
from collections import Counter

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

n=int(input())
a=LI()
c=Counter(a)

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

Submission status: Accepted

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

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

for i in cnt:
    print(i)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = LIST()

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

    ans.append(0)
    print(*ans,  sep='\n')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
arr = {}
s = list(map(int, input().split()))
for i in range(1, n):
  arr[s[i-1]] = arr.get(s[i-1], 0) + 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
L = list(map(int, input().split()))
d = Counter() #インスタンスを生成
d.update(L)

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = [int(t)for t in input().split()]
    ans = [0]*n
    for i in range(n-1)[::-1]:
        ans[a[i]] += 1

    for ans_i in ans[1:]:
        print(ans_i)
    print(0)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

m = {}
for i in range(1, n+1):
    m[i] = 0
for a in A:
    m[a] += 1
for v in m.values():
    print(v)

Submission status: Accepted

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

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

for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for j in range(N-1):
  a[s[j]-1]+=1
for h in range(N):
  print (a[h])

Submission status: Accepted

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

Submission status: Accepted

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

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

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

for b in buka:
    print(b)

Submission status: Accepted

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

count=[0]*N

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

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

Submission status: Accepted

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

for i in range(N-1):
    #iの上司はA[i]
    staff[A[i]-1] += 1

for i in staff:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

A=[int(_) for _ in input().split(" ")]

b=[]

for i in range(N):
    b.append(0)

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


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

Submission status: Accepted

Solution code:
from collections import Counter

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

d = Counter(A)

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
  n = int(input())
  a_list = [int(i) for i in input().split()]

  ans_list = [0]*n
  for item in a_list:
    ans_list[item-1] += 1

  for i in ans_list:
    print(int(i))

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(data)

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

Submission status: Accepted

Solution code:
import collections

n, *a = map(int, open(0).read().split())

l = collections.Counter(a)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
num = {}

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

A = list(map(int, input().split(" ")))
for i in range(len(A)):
    num[A[i]-1] += 1

[print(num[i]) for i in range(N)]

Submission status: Accepted

Solution code:
import sys, math

n = int(sys.stdin.readline().strip() )
nums = map(int, sys.stdin.readline().split())
infer = [0] * n
for n in nums:
    infer[n-1] += 1
for one in infer:
    print(one)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

boss = list(map(int,input().split()))
             
shain = [0]*n

for i in boss:
  shain[i-1] += 1
  
for i in range(n):
  print(shain[i])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

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

ans = [0] * (N+1)

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

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

Submission status: Accepted

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

joshi = {}

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

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

for key in joshi.keys():
    print(joshi[key])

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
A = [int(x) for x in input().split()]
dict = Counter(A)
#print(dict.keys)
for i in range(1, N+1):
    print(dict[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(c) for c in input().split()]
out = [0] * n
for item in a:
    out[item] += 1
for item in out[1:]:
    print(item)
print(0)

Submission status: Accepted

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

ans = [0] * (n*10)

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

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

Submission status: Accepted

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

d = {}
for idx in range(N):
    d[idx+1] = 0

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

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