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:
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  5 00:00:01 2020

@author: Aruto Hosaka
"""

import collections

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

C = collections.Counter(A)

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

Submission status: Accepted

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

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

for mng in a:
    sub[mng] += 1

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

Submission status: Accepted

Solution code:
from collections import Counter

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

# N: 会社員の人数
# 自分より番号が小さい人が直属の上司
N = int(input())
# A_i は社員番号iの直属の上司の社員番号
A = list(map(int, input().split()))

ans = np.zeros(N)

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

    tree = [list() for i in range(N)]
    for i in range(N - 1):
        tree[A[i] - 1].append(i + 1)

    for i in range(N):
        print(len(tree[i]))


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import defaultdict

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

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    A = LI()
    sub = [0]*n
    for a in A:
        sub[a-1] += 1
    for s in sub:
        print(s)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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


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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = LI()

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

    printlist(P, '\n')

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

l = [0 for _ in range(n+1)]
for i in a:
    l[int(i)]+=1

for j in range(1,n+1):
    print(l[j])

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

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


def solve():
    n = ri()
    L = [0] * (n + 1)
    for i in rl():
        L[i] += 1

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






mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()

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()))
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()))
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:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * n
for i in a:
    b[i - 1] += 1
print(*b, sep="\n")

Submission status: Accepted

Solution code:
from collections import Counter

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#163C
#management

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

Submission status: Accepted

Solution code:
n = int(input())

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

diff = [0] * n

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

for j in diff:
    print(j)

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())
a = [int(i) for i in input().split()]
mapping = defaultdict(int)
for _a, i in zip(range(2, n + 1), a):
  mapping[i] += 1
for i in range(1, n + 1):
  print(mapping[i])

Submission status: Accepted

Solution code:
n = int(input())

list_ = [0]*n
joshi_list = list(map(int, input().split()))[::-1]

for i,num in enumerate(joshi_list):
  list_[num-1]+=1

for num in list_:
  print(num)

Submission status: Accepted

Solution code:
import sys
from collections import Counter


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    cnt = Counter(a)
    for i in range(1, n + 1):
        print(cnt[i])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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


ac = collections.Counter(a)

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

Submission status: Accepted

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

B=Counter(A)


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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans=[0]*n

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

for j in ans:
    print(j)

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
A=input().split()
n=np.zeros(N)

for i in range(N-1):
  n[int(A[i])-1]+=1
for l in n :
  print(int(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(1, n + 1):
  print(c[i])

Submission status: Accepted

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

for i in (a):
  sub_list[i - 1] += 1

for i in range(n):
  print(sub_list[i], sep = ',')

Submission status: Accepted

Solution code:
N = int(input())

result = [0] * (N + 1)

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

result.pop(0)

for r in result:
    print(r)

Submission status: Accepted

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

y = collections.Counter(x)

for i in range(1, len(x)+2):
  print(y[i], end = "\n")

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
ans = [0 for i 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())
arr = [int(x) for x in input().split()]
count = [0 for x in range(n)]
for i in arr:
	count[i-1]+=1
for i in count:
	print(i)

Submission status: Accepted

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

ans = [0] * n

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

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

Submission status: Accepted

Solution code:
n = int(input())

counter = [0 for i in range(n)]
A = list(map(int, input().split()))

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

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

Submission status: Accepted

Solution code:
import sys

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

ans = [0] * n

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

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

Submission status: Accepted

Solution code:
import sys

n = int(input())
A = list(map(int, sys.stdin.readline().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()))

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

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

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

Submission status: Accepted

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

for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

c = collections.Counter(l)

# Counter({'a': 4, 'c': 2, 'b': 1})
for i in range(1, n+1):
  if i in c:
    print(c[i])
  else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
As = list(map(int,input().split()))
cnt = Counter(As)
for i in range(1,N+1):
  print(cnt[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 j in ans:
    print(j)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def main():
    N=int(sys.stdin.readline())
    A=tuple(map(int,sys.stdin.readline().split()))
    R=[0 for _ in range(N)]
    for a in A:R[a-1]+=1
    for r in R:print(r)
if __name__=='__main__':main()

Submission status: Accepted

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

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


for a in ans:
    print(a)

Submission status: Accepted

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

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

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

print(0)

Submission status: Accepted

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

import collections
A_count = collections.Counter(A)

keys = A_count.keys()

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

Submission status: Accepted

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

man_list=[0]*N

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

print(*man_list)

Submission status: Accepted

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

man=1
cnt=0
man_list=[0]*N

A.sort()
A += [0]

for a in A:
  if a != man:
    man_list[man-1] = cnt
    man = a
    cnt=0
  cnt+=1

print(*man_list)

Submission status: Accepted

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

man=1
cnt=0
man_list=[0]*N
A.sort()
A += [0]

for a in A:
  if a != man:
    man_list[man-1] = cnt
    man = a
    cnt=0
  cnt+=1

for l in man_list:
  print(l)

Submission status: Accepted

Solution code:
def main():
    N = input_int()
    A = input_int_list_in_line()
    A = [-1, -1] + A

    num_buka = [0] * (N+1)

    for i in range(2, len(A)):
        num_buka[A[i]] += 1

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


def input_int():
    return int(input())


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


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


def input_int_tuple_list(n: int, q: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()

Submission status: Accepted

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

cnt = {}
for i in a:
    cnt.setdefault(i, 0)
    cnt[i] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(N-1):
    ans[a[i]-1].append(i+2)
for i in range(N):
    print(len(ans[i]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()

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

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

for i in ans:
  print(i)

Submission status: Accepted

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
A = ri_()
B = [0] * N
for Ai in A:
    B[Ai - 1] += 1
for Bi in B:
    print(Bi)

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

Submission status: Accepted

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

from collections import defaultdict


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


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

for me in memo.values():
    print(me)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
t=0
for i in range(n):
  ans=0
  while True:
    if t==n-1:
      print(ans)
      break
    if a[t]==i+1:
      t=t+1
      ans=ans+1
    else:
      print(ans)
      break

Submission status: Accepted

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

buka = [0]*N

for a in range(N-1):
    buka[A[a]-1] += 1

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    
    staff_list = []
    for _ in range(n):
        staff_list.append(0)
    
    for boss_index in a_list:
        staff_list[boss_index-1] += 1
    
    for staff in staff_list:
        print(staff)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
  n = int(input())
  A = list(map(int, input().split()))
  
  num = [0] * n + [0]
  
  # for i in range(0, n-1):
  #   for k in range(0, len(A)):
  #     if A[k] == i+1:
  #       num[i] += 1
  
  for i in range(0, n-1):
    num[A[i]] += 1
  
  for k in range(1, n+1):    
    print(num[k])
  
main()

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
  #print(a[i]-1)

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

Submission status: Accepted

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
B = [0]*(N+1)
for i in range(N-1):
    B[A[i]] += 1
print('\n'.join([str(n) for n in B[1:]]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

DP = [0 for i in range(N+1)]
for i in A:
  DP[i] += 1
  
for i in DP[1:]:
  print(i)

Submission status: Accepted

Solution code:
N = int(input())
l = [0]*N
A = [j for j in map(int, input().split())]

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
# for i in range(n):
#     count = 0
#     while True:
#         if i+1 in a:
#             a.remove(i+1)
#             count += 1
#         else:
#             break
#     print(count)
b = [0]*n
for i in range(n-1):
    b[a[i]-1] += 1
for i in range(n):
    print(b[i])

Submission status: Accepted

Solution code:
import numpy as np

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

worker = list(np.zeros(n, dtype=int))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

resolve()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = {}
for i in range(1, n+1):
    a[i] = []

member = list(map(int, input().split()))
for i in member:
    a[i].append(1)

for j in a:
    print(len(a[j]))

Submission status: Accepted

Solution code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n = I()
    a = list(IL())
    m = [0]*n
    for rep in a:
        m[rep-1] += 1
    for rep in m:
        print(rep)
    return

if __name__=='__main__':
    Main()

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 an in ans:
  print(an)

Submission status: Accepted

Solution code:
n=int(input())

lst=list(map(int,input().split(' ')))

final=[0]*n

for i in lst:
    final[i-1]+=1
print(*final, sep='\n')

Submission status: Accepted

Solution code:
n=int(input())

lst=list(map(int,input().split(' ')))

final=[0]*n

for i in lst:
    final[i-1]+=1
for i in final:
    print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

num.sort()
cnt = 0
work = 0
sum = 0
flg = 0
for i in num:
  if work != i:
    if work != 0:
      print(cnt)
      sum += 1
    cnt = 1
    mae = work + 1
    work = i
    if mae != work:
      for i in range(mae,work):
        print(0)
        sum += 1
  elif work == i:
    cnt += 1
  

print(cnt)
sum += 1
sum = int(n) - sum
for i in range(sum):
  print(0)

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))
    buka = [0]*n

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

    for i in buka:
        print(i)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#163
N = int(input())
employees = list(map(int,input().split()))
bosses_num = [0]*N
for employee in employees:
    bosses_num[employee-1]+=1
for boss_num in bosses_num:
    print(boss_num)

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in mem:
	print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=[0 for i in range(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()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
emplist = [int(x) for x in input().split()]

ans = Counter(emplist)

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

Submission status: Accepted

Solution code:
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

n = int(input())
b = {}
vals = list(map(int, input().split()))
for i in range(n-1):
    if(vals[i] in b):
        b[vals[i]]+=1
    else:
        b[vals[i]] = 1
for i in range(1, n+1):
    if(i in b):
        print(b[i])
    else:
        print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for x in member:
    print(x)

Submission status: Accepted

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

members = [0] * n
for boss in a:
    members[boss-1] += 1
for ans in members:
    print(ans)

Submission status: Accepted

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

li = [0]*n

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

#print(li)

for j in li:
    print(j)

Submission status: Accepted

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

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

for j in list:
    print(j)

Submission status: Accepted

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

Submission status: Accepted

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

Ans = [0] * N

for x in range(N-1):
    Ans[A[x]-1] += 1

for x in range(N):
    print(Ans[x])

Submission status: Accepted

Solution code:
n = int(input())
datas = [int(i) for i in input().split()]
outputs = [0] * n
for i in datas:
  outputs[i - 1] += 1
for i in outputs:
  print(i)

Submission status: Accepted

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

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

for i in worker:
    print(i)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
from collections import defaultdict as ddict

B = ddict(int)
for a in A:
  B[a-1] += 1
for n in range(N):
  print(B[n])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import Counter
n, *a = map(int, open(0).read().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()))
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())
a = list(map(int, input().split()))
l = [0] * n

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

for j in l:
    print(j)

Submission status: Accepted

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

for result in b:
  print(result)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

    for i in mem:
        print(i)

if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 i in range(N):
  print(l[i])

Submission status: Accepted

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

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

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