Problem:


Score : 300 points

Problem Statement

A company has N members, who are assigned ID numbers 1, ..., N.

Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.

When a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.

You are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq A_i < i

Input

Input is given from Standard Input in the following format:

N
A_2 ... A_N

Output

For each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.

Sample Input 1

5
1 1 2 2

Sample Output 1

2
2
0
0
0

The member numbered 1 has two immediate subordinates: the members numbered 2 and 3.

The member numbered 2 has two immediate subordinates: the members numbered 4 and 5.

The members numbered 3, 4, and 5 do not have immediate subordinates.

Sample Input 2

10
1 1 1 1 1 1 1 1 1

Sample Output 2

9
0
0
0
0
0
0
0
0
0

Sample Input 3

7
1 2 3 4 5 6

Sample Output 3

1
1
1
1
1
1
0



Sample input:
5
1 1 2 2


Sample output:
2
2
0
0
0

Submission status: Accepted

Solution code:
import heapq
import math
import random
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, namedtuple, UserDict
from functools import cmp_to_key, lru_cache, reduce
from itertools import (chain, combinations, combinations_with_replacement,
                       permutations, product)

sys.setrecursionlimit(10**6+1)
write = sys.stdout.write
# input = sys.stdin.buffer.readline

MOD = 10**9 + 7


if __name__ == "__main__":
    n = int(input())
    arr = [int(ch) for ch in input().split()]
    ans = [0] * (n+1)
    for i in arr:
        ans[i] += 1
    print(*ans[1:], sep='\n')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(A)

i=1

for j in range(N):
  print(c[i])
  i+=1

Submission status: Accepted

Solution code:
man = input()
m = input()
master = m.split()
anser = [0 for i in range(int(man))]
for i in range(int(man)-1):
  anser[int(master[i])-1]+=1
for i in range(int(man)):
  print(int(anser[i]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split());c=[0]*n
for q in a:c[q-1]+=1
print(*c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split());c=[0]*n
for q in a:c[q-1]+=1
for d in c:print(d)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def management(N,array):
  res = [0]*N
  for i in range(len(array)):
    res[array[i]-1] += 1
  for j in range(len(res)):
    print(res[j])

if __name__ == '__main__':
  N = int(input())
  array = list(map(int,input().split()))
  management(N,array)

Submission status: Accepted

Solution code:
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math
#import counter
import collections

N = int(input())
s = input().split()
p = [int(w) for w in s] #これで勝手にNまで拾ってくれます

'''
ans_list = [0 for i in range(N)]

for i in range(len(p)):
    ans_list[p[i]-1] += 1

for i in range(N):
    print(ans_list[i])
'''
c = collections.Counter(p)
#print(c)
for i in range(N):
    print(c[i+1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
As = list(map(int, input().split()))
ans = [0 for _ in range(N)]
 
for a in As:
    ans[a-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(N-1):
    ans[A[i]]+=1
for j in range(1,N+1):
    print(ans[j])

Submission status: Accepted

Solution code:
n=int(input(''))
a= [int(s) for s in input().split(" ")]
t=[0]*(n+1)
for i in range(0,len(a)):
        t[a[i]]+=1
for i in range(1,n+1):
    print(t[i])

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(2,n+2):
    print(b[i-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

x=(n+1)*[0]

for i in a:
    x[i]+=1
for i in x[1:]:
    print(i)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    d = defaultdict(lambda : 0)
    for i in a:
        d[i-1] += 1
    for i in range(n):
        print(d[i])
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
from collections import Counter

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

Submission status: Accepted

Solution code:
import math
if __name__ == '__main__':
    N = int(input())
    A = [int(elem) for elem in input().split()]
    count = [0]*N
    for i in A:
      #  print("i", i)
      #  print("A",A[i-1])
        count[i-1] = count[i-1]+1
    
    [print (i) for i in count]

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 ans in joshi.values():
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in N:
    print(i)

Submission status: Accepted

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

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

for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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 = [int(i) for i in input().split()]

ans = [0] * N

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
values,counts = zip(*c.most_common())
A = sorted(c.most_common(), key=lambda x: x[0])
A.append([-1])
p = 0
for u in range(N):
    if A[p] != -1:
        if A[p][0] != u+1:
            print(0)
        else :
            print(A[p][1])
            p+=1
    else :
        print(0)

Submission status: Accepted

Solution code:
n = int(input())
A = [-1, -1] + list(map(int, input().split())) # n-1

cnt = [0] * (n + 1)

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

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

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] +=1

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

Submission status: Accepted

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

b = [0]* ppap


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

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

Submission status: Accepted

Solution code:
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

    t = Counter(A)

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


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

sub=[0]*N

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

for item in sub:
    print(item)

Submission status: Accepted

Solution code:
n, *A = list(map(int, open(0).read().split()))
B = [0] * n
for a in A:
    B[a-1] += 1
print(*B, sep='\n')

Submission status: Accepted

Solution code:
from collections import Counter

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

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()))
buka_num=[0 for _ in range(N+1)]

for i in a:
  buka_num[i]+=1
buka_num.pop(0)
for j in buka_num:
  print(j)

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 i in b:
  print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

n = int(input())
List = list(map(int, input().split()))
Col = collections.Counter(List)
Col2 = sorted(Col.items())
CountList = [0]*n
for i in Col2:
    CountList[i[0]-1] = i[1]
#CountList = list(Col2.values()) 
#for i in range(n-len(CountList)):
#    CountList.append(0)

for i in CountList:
    print(i)

Submission status: Accepted

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

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

print(*num)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import collections
n = int(input())
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 = list(map(int, input().split()))

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

[print(j) for j in res]

Submission status: Accepted

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

c = [0] * N

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
a_list = deque(sorted(list(map(int, input().split()))))
a = [0 for i in range(n)]
for i in range(n-1):
    a[a_list.popleft()-1] += 1
for i in a:
    print(i)

Submission status: Accepted

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

num = [0] * n

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

print(*num)

Submission status: Accepted

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

boss_count_list = [0] * n


for val in boss_list:
  boss_count_list[val - 1] += 1

for val in boss_count_list:
  print(val)

Submission status: Accepted

Solution code:
import numpy as np

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

A.append(0)

for i in range(0, 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 = list(map(int, input().split()))

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

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

Submission status: Accepted

Solution code:
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    n = ni()
    a = nl()

    ans = [0]*n

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

    for value in ans:
        print(value)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
num = int(input())
li = list(int(x) for x in input().split())
li2 = [0] * num
num = len(li)
for i in li:
  li2[i - 1] = li2[i - 1] + 1
for j in range(num + 1):
  print(li2[j])

Submission status: Accepted

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

result = [0] * N
for i in numbers:
    result[i- 1] += 1
    
for i in range(N-1):
    print(result[i])
print(0)

Submission status: Accepted

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

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:
N = int(input())
As = list(map(int, input().split()))
ct = [0] * N
     
for a in As: #ここがキモ．リスト「As」にはそれぞれの上司が入っていて，その中からaを取り出すので，a=上司になっている．これにより，ctの上司を正確に呼び出すことができる．
    ct[a-1] += 1
     
for c in ct:
    print(c)

#別解
#print(*c,sep='\n')

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, *a = map(int, read().split())
ans = [0] * n
for i in a:
    ans[i - 1] += 1
print(*ans)

Submission status: Accepted

Solution code:
from collections import Counter

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


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

Submission status: Accepted

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

Submission status: Accepted

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

    tree = [[] for _ in range(N + 1)]
    for k, a in enumerate(A, 2):
        tree[a].append(k)

    ans = [len(t) for t in tree]
    return ' '.join(map(str, ans[1:]))

print(c_management_tree())

Submission status: Accepted

Solution code:
def c_management():
    from collections import Counter
    N = int(input())
    A = [int(i) for i in input().split()]

    count = Counter(A)
    ans = [count[i] for i in range(1, N + 1)]
    return ' '.join(map(str, ans))

print(c_management())

Submission status: Accepted

Solution code:

from collections import Counter
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  results = [0] * N
  for a in A:
    results[a-1] += 1
  for r in results:
    print(r)

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

for b2 in b:
    print(b2)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

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

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
import collections
import numpy as np

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

zero = np.zeros(n+1)
c = collections.Counter(a)

for val,key in c.items():
    zero[val] = key

for i in range(len(zero)):
    if i > 0:
        print(int(zero[i]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s = [0]*(n)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
Buka = []
for i in range(N):
  Buka.append(0)
for j in A:
  Buka[j-1] += 1
for k in range(N):
  print(Buka[k])

Submission status: Accepted

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

L=[]
for i in range(n):
  L.append(0)
  
i=0
for i in range(n-1):
  cnt=List[i]
  L[cnt-1]=L[cnt-1]+1
  
for List in L:
  print(List)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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(str(L[i]))

Submission status: Accepted

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

result = [0] * N
for a in A:
    result[a - 1] += 1
print('\n'.join(map(str, result)))

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
import collections

N = int(input())
A = list(map(int, input().split()))
ans = [0] * (N+1)
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 sys
input = sys.stdin.readline

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

sub_list = [0] *n

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

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

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline().rstrip())
A = [int(x) for x in sys.stdin.readline().rstrip().split(" ")]

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

for bango in A:
	count[bango - 1] += 1

for c in count:
	print(c)

Submission status: Accepted

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

arr = [0] * N

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    a = int(input())
    b = list(map(int, input().split()))
    c = [0]*a
    for i in b:
        c[i-1] += 1
    for j in c:
        print(j)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(*ans)

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

ans = [0] * n

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
array = list(map(int, input().strip().split()))
array.sort()
ansarray = []
ansnum = 1
ans = 0
ansindex = 0
for i in range (1,N):
    for j in range(ansindex,N-1):
        if (array[j] == i):
            ans += 1
            ansindex += 1
        else:
            ansarray.append(ans)
            ans = 0
            break
        if(j == N-2):
            ansarray.append(ans)
            ansindex += 1
for i in range(N-len(ansarray)):
    ansarray.append("0")
for i in range(N):
    print(ansarray[i])

Submission status: Accepted

Solution code:
import collections
 
n= int(input())
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:
import collections

N = int(input())
A = list(map(int, input().split()))
# collections.Counter(A)で速くなる！！
cnt = collections.Counter(A)
for i in range(1, N+1):
    print(cnt[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = []
s = [0] * n
a.append(input().split())

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

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

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

Submission status: Accepted

Solution code:
#整数の入力
N = int(input())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

ans = 0
  
  
ans_list = [0]*N
  
for i in range(len(A_list)):
  #ans = A_list.count(i+1)
  ans_list[A_list[i]-1]+=1


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

Submission status: Accepted

Solution code:
import sys
import collections
input = sys.stdin.readline
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())
a=list(map(int,input().split()))
ls=[0]*n

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
 
N = int(input())
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 = list(map(int,input().split()))
b = [[] for _ in range(n+1)]
for i in range(2, n+1):
    b[a[i-2]].append(i)

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

Submission status: Accepted

Solution code:
import collections

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

A_cnt = collections.Counter(A)

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

Submission status: Accepted

Solution code:
import collections

N = int(input())
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:
from collections import defaultdict

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

d = defaultdict(int)
for a in A:
  d[a] += 1

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

Submission status: Accepted

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

ans = [0] * n

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

print(*ans)

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

Buka_list = []

for i in range(N):
    Buka_list.append(0)
    
for j in A_list:
    Buka_list[j-1] += 1

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

Submission status: Accepted

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

#for i in lst:
#  dct[i] += 1
dct = Counter(lst)#{i: 0 for i in range(n+1)}
for i in range(1, n+1):
  print(dct[i])

Submission status: Accepted

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