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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

for i in ans:
  print(i)

Submission status: Accepted

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

result = [0] * N

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

for i in result:
    print(i)
    print('\n')

Submission status: Accepted

Solution code:
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    n = I()
    a = LI()
    d = dict()
    for i in range(1,n+1):
        d[i]=0
    for i in range(len(a)):
        d[a[i]]+=1

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

my_code()

Submission status: Accepted

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


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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

p = [0]*N

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

for i in p:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
b = np.zeros(n)
for i in a: b[i-1] += 1
for i in b: print(int(i))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append(0)
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().strip().split()))
M = [0] * N
 
for i in range(0, len(A)):
    M[(A[i]-1)] += 1
 
for j in range(0, N):
    print(M[j])

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(0,N):
    print(C[i+1])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

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

import collections
cnt=0
c=collections.Counter(a)
for i in range(1,n+1):
    if i not in c.keys():
        print(0)
    else:
        print(c[i])

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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):
 b[i]=str(b[i])
 print(b[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def input_int_list():
    return [int(thing) for thing in input().split(" ")]

def int_input():
    return int(input())


import collections
N = int_input()
A_list = input_int_list()
C = collections.Counter(A_list)
for i in range(1, N+1):
    if i in C:
        pass
    else:
        C[i] = 0

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n = II()
    a = LI()
    ans = [0] * n
    for i in range(n-1):
        ans[a[i] - 1] += 1
    print("\n".join(map(str, ans)))
    return


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

Submission status: Accepted

Solution code:
n = int(input())
list_shain_index = list(map(int, input().split()))
list_num_buka = [0]*(n+1)
for num in list_shain_index:
  list_num_buka[int(num)] += 1

list_ans = map(str, list_num_buka[1:])
print(' '.join(list_ans))

Submission status: Accepted

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

cnt = defaultdict(lambda :0)
for i in a:
    cnt[i] += 1

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

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

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

Submission status: Accepted

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

previous=1
count=0
for j in a+[n+1]:
    if j==previous:
        count+=1
    else:
        print(count)
        count=1
        for _ in range(j-previous-1):
            print(0)
        previous=j

Submission status: Accepted

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

from collections import Counter
c = Counter(a_li)

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

Submission status: Accepted

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

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

for k in n_subord:
    print(k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import math

s = [input() for i in range(2)]
n = int(s[0])
a = list(map(int, s[1].split()))

# n = 5
# a = [1, 1, 2, 2]

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

for line in x:
    print(line)

Submission status: Accepted

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

for i in A:
  c[i-1] += 1
for i in c:
  print(i)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

# C - management
N = int(input())
A = list(map(int, input().split()))
bosses = dict()

for a in A:
  if a in bosses.keys():
	  bosses[a] += 1
  else:
    bosses[a] = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    A = kwargs["A"]
    B = [0 for i in range(n)]

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

    res = "\n".join([str(i) for i in B])
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    kwargs["n"] = [int(i) for i in cin][0]
    #kwargs["n"], kwargs["k"] = [int(i) for i in cin]
    cin = input().split()
    kwargs["A"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Submission status: Accepted

Solution code:
n = int(input())
l = map(int, input().split())
d = {k:0 for k in range(1, n+1)}
for i in l:
    d[i] += 1
for i, j in d.items():
    print(j)

Submission status: Accepted

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

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, N+1):
  print (C[i])

Submission status: Accepted

Solution code:
n=int(input())
#a,b=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

dic={}

for val in al:
    dic[val]=dic.get(val,0)+1

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

Submission status: Accepted

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

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

    for a in ans:
        print(a)


    return

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

for i in L:
    print(i)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())

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

c = Counter(l)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import os
 
def main():
        n = int(input())
        a_list = list(map(int, input().split()))
        result = [0] * n
        for i in a_list:
            result[i-1] += 1
        for i in result:
                print(i)
 
if __name__ == "__main__":
        main()

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())

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

for i in range(1,N+1):
  print(A.get(i) if A.get(i) is not None else 0)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    n = int(input())
    a = [int(x) for x in input().split()]
    result = [0 for x in range(len(a)+1)]

    for item in a:
        result[item-1] += 1

    for item in result:
        print(item)

Submission status: Accepted

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

for boss in A:
  subs[boss-1] += 1

for i in subs:
  print(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]+=1
print(*b)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

lis = [0] * N
for i in A:
    lis[i-1] += 1

for i in range(len(lis)):
    print(lis[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()))

lis = [0] * n
for i in A:
  lis[i-1] += 1

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

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline

import numpy as np

n = int(readline())
a = np.array(readline().split(), np.int32)

a -= 1
ans = np.bincount(a, minlength=n)
print(*ans, sep="\n")

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

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

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

for ans in cnt:
    print(ans)

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:
import collections

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

# リストの中の各値が何個かあるかを連想配列化する
# ['a','b','d','b','e','a','c','d','b'] → {'a':2,'b':3,'c':1,'d':2,'e':1}
AC = collections.Counter(A)

# 1～Nまでの個数を出力する（rangeは第1引数から第2引数-1までの範囲）
# 例：range(1,5)→1,2,3,4
for i in range(1, N+1):
    # 連想配列にiと同じキーがあれば、その値を出力
    if i in AC:
        print(AC[i])

    # キーがない場合は0個ということなので、0を出力
    else:
        print(0)

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:
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
buka = [0 for i in range(n)]

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

for i in buka:
    print(i)

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 range(N-1):
  ans[A[i]-1] += 1
for i in range(N):
  print(ans[i])

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

Submission status: Accepted

Solution code:
n=int(input())
l=[0]*n
for s in input().split():
  l[int(s)-1]+=1
for x in l:
  print(x)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

K = [0]*N

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

buka_list = [0] * (n+1)

for a_i in a:
    buka_list[a_i] = buka_list[a_i] + 1

for x in buka_list[1:]:
    print(x)

Submission status: Accepted

Solution code:
from collections import defaultdict

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

tree = defaultdict(set)
for i, a in enumerate(A, 2):
    tree[a].add(i)
for i in range(1, 1 + N):
    print(len(tree[i]))

Submission status: Accepted

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

x = [0]*N

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

for i in x:
    print(i)

Submission status: Accepted

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

b = {i + 1:0 for i in range(n)}
for i in a:
    b[i] += 1
c = list(b.items())
c.sort()
for i in range(n):
    print(c[i][1])

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys
input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = [0] * int(input())

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

print(*x)

Submission status: Accepted

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

dict={}

for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
dict[N]=0

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

Submission status: Accepted

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

Submission status: Accepted

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

buka=dict()
for x in a:
    if x not in buka:
        buka[x]=1
    else:
        buka[x]+=1
for i in range(n):
    if (i+1) not in buka:
        print(0)
    else:
        print(buka[i+1])

Submission status: Accepted

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

Submission status: Accepted

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

A.sort()

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

li = [0]*n

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

for i in li:
    print(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 ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

A = [-1] + [int(x) - 1 for x in input().split(" ")]

resses = [0] * n

for i in range(1, n):
    resses[A[i]] += 1

for res in resses:
    print(res)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import Counter

n = ni()
a = na()

c = Counter(a)
ans = [0] * n
for k, v in c.items():
    ans[k - 1] = v

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

Submission status: Accepted

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

B = [0] * (n + 1)
for a in A:
    B[a] += 1

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)

#const
dxdy=((1,0),(0,1))
#my functions here!
def pin(type=int):
    return map(type,input().rstrip().split())


#your code here!
def resolve():
    N,=pin()
    A=((pin()))
    ans=[0]*N
    for a in A:
        ans[a]+=1
    for v in ans[1:]:
        print(v)
    print(0)

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5
1 1 2 2"""
        output = """2
2
0
0
0"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10
1 1 1 1 1 1 1 1 1"""
        output = """9
0
0
0
0
0
0
0
0
0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """7
1 2 3 4 5 6"""
        output = """1
1
1
1
1
1
0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    #unittest.main()

    #I wrote my code above!

    resolve()#and submit 2 atcoder!

Submission status: Accepted

Solution code:
import bisect
n = int(input())
a = list(map(int, input().split()))
a.sort()
d = {0: 0}
for i in range(1, n + 1):
    d[i] = bisect.bisect_right(a, i)
    print(d[i] - d[i - 1])

Submission status: Accepted

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

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:
import collections
n = int(input())
a = [int(x) for x in input().split()]
a = collections.Counter(a)
for i in range(n):
    print(a[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:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    counter = [0] * n
    for a in map(int,input().split()):
        counter[a - 1] += 1
    print(*counter, sep='\n')
resolve()

Submission status: Accepted

Solution code:
import  collections

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = tuple(map(int, input().split()))
All = Counter(a)
for i in range(1,n+1):
    try:
        print(All[i])
    except:
        print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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())
arr = [int(x) for x in input().split() ]
d = {}

for i,x in enumerate(arr):
	d[x] = d.get(x,0) + 1
    
for i in range(1,n+1):
  print(d.get(i,0))

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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