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=[int(x)for x in input().split()]
c=[0]*n
for e in a:c[e-1]+=1
for e in c:print(e)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = int(input().strip())
A = [int(str) for str in input().strip().split()]

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

for b in B:
    print(b)

Submission status: Accepted

Solution code:
N = int(input())
sum = 0
now = 1
for i in sorted(list(map(int,input().split()))):
    if(now == i):
        sum += 1
    else:
        print(sum)
        for j in range(i-now-1):
            print(0)
        now = i
        sum = 1
else:
    print(sum)
while(now < N):
    now += 1
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

employees = list(map(int, input().split(" ")))

subordinates = [0] * N

for employee in employees:
    subordinates[employee-1] += 1
    
for i in range(N):
    print(subordinates[i])

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
l = list(input().split())
c = Counter(l)
for i in range(1, n+1):
    if c[str(i)]:
        print(c[str(i)], sep=' ')
    else:
        print(0, sep=' ')

Submission status: Accepted

Solution code:
N = int(input())
syain = []
for i in range(N):
	syain.append(0)
x =(input()).split(" ")
xid = [int(s) for s in x]
for t in xid:
	syain[t-1]+=1
for m in syain:
	print(m)

Submission status: Accepted

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

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] = str(int(ans[a[i]-1])+1)
print("\n".join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(M)

#print(c)

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

Submission status: Accepted

Solution code:
from collections import defaultdict

sh = int(input())
b = input()

id = [int(n) for n in b.split(" ")]
D = defaultdict(int)
for i in id:
    if i not in D:
        D[i] = 1
    else:
        D[i] += 1
#print(D)

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

Submission status: Accepted

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

Submission status: Accepted

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

N_map = {}

for i in range(1, N+1):
    N_map[i] = 0

for i in A:
    if i in N_map:
        N_map[i] += 1

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

Submission status: Accepted

Solution code:
n = int(input())
ans = [0] * n
for x in map(int, input().split()):
  ans[x-1] += 1

for x in ans:
  print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter


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



c=Counter(a)
ck=set(Counter(a).keys())
for i in range(1,n+1):
    if i in ck:
        print(c[i])
    else:
        print(0)

Submission status: Accepted

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

import collections
c = collections.Counter(A)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

[print(i) for i in res]

Submission status: Accepted

Solution code:


n = int(input())

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

from collections import Counter

cntr = Counter(worker_nums)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

A.sort()
if A[0]==0:
    A.remove(0)

l=len(A)
k=0

ans=1

m=max(A)

for i in range(l-1):
    if A[i+1]>A[i]:
        k=A[i]
        print(ans)
        while A[i+1]!=k+1:
            k=k+1
            print(0)
        ans=1
    else:
        ans=ans+1
if A[l-1]==A[l-2]:
    print(ans)
else:
    print(ans)
    
   
for j in range(m+1,N+1):
    print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

lines = sys.stdin.read().splitlines()

total_num_employee = int(lines[0])
list_of_zyoshi = lines[1].split()
num_of_buka = defaultdict(int)
result = ""
for zyoshi_id in list_of_zyoshi:
    num_of_buka[zyoshi_id] += 1

for employee_id in range(1, total_num_employee + 1):
    result += str(num_of_buka[str(employee_id)]) + "\n"
print(result)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter

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

D = Counter(arg)

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

Submission status: Accepted

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

for r in result:
    print(r)

Submission status: Accepted

Solution code:
import collections
N = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
i = 1
while i < N+1:
  print(c[i])
  i+=1

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    E = {}
    A = input()
    for _, a in enumerate(map(lambda i: int(i)-1, A.split(' '))):
        E[a] = E.get(a, 0) + 1

    for i in range(N):
        print(E.get(i, 0))

main()

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
C = Counter(map(int,input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
r=[0]*n
j=list(map(int, input().split()))
for i in j:
    r[i-1]+=1
for i in r:
    print(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:
import collections
N =int(input())
A = list(map(int, input().split()))

k=0
t=1
a=collections.Counter(A)
for i in range(1,N+1):
    print(a[i])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
# 文字列の入力
s = input()
t = s.split(" ")
#print(t)
ans = []
for i in range(N):
    ans.append(0)

#print(ans)

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

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
import collections
n = int(input())
li = list(map(int, input().split()))
cnt = dict(collections.Counter(li))
for i in range(1,n+1):
    print(cnt.get(i, 0))

Submission status: Accepted

Solution code:
from collections import deque

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


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

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

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


resolve()

Submission status: Accepted

Solution code:
from collections import Counter

N=int(input())
list = list(map(int, input().split()))
i=1
counter = Counter(list)

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

Submission status: Accepted

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

import collections

N = int(input())

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

c = collections.Counter(l)

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

ans = [0] * n;

c = collections.Counter(A)
key = list(c.keys());
value = list(c.values());

for i in range(len(key)):
    ans[key[i]-1] = value[i];
  
for a in ans:
  print(a);

Submission status: Accepted

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

Submission status: Accepted

Solution code:
from collections import Counter


def main():
    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__":
    main()

Submission status: Accepted

Solution code:
import collections
a = int(input())
num = list(map(int,input().split()))
c = collections.Counter(num)
list(map(lambda x: print(c[x]), range(1,a+1)))

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:
num=int(input())
date=input().rstrip().split(" ")
list0=[]
for i in range(num-1):
  list0.append([])
for j in range(num-1):
  list0[int(date[j])-1].append(0)
for k in range(num-1):
  print(len(list0[k]))
print(0)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = [int(a) for a in input().split()]
s = np.zeros(N, dtype=np.int)
for i in range(len(A)):
    s[A[i]-1] += 1
for ans in s:
    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:
N = int(input())
a = [int(x) for x in input().split()]
answer = [0] * N
for i in range(1,N):
    x = a[i-1]
    answer[x-1] +=1

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = input().rstrip().split(' ')
length = len(s)
lst = [0] * n
for i in range(length):
  m = int(s[i])
  lst[m-1] += 1
for j in range(n):
  print(lst[j])

Submission status: Accepted

Solution code:
#k,x = map(int,input().split())	
n= int(input())
arr = list(map(int,input().split()))
keys = []
for _ in range(1,n+1):
    keys.append(_)
#print(keys)

values = [0]*(n+1)
dic = {k: v for k, v in zip(keys, values)}
#print(dic)
for i in range(n-1): #各単語の出現回数を数える
 if arr[i] not in dic:
   dic[arr[i]]=1
 else:
   dic[arr[i]]+=1
#print(dic)  # -> {'a': 2, 'b': 3}
for i in dic.values():
    print(i)

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

Submission status: Accepted

Solution code:
#string = ' '.join(list(input() for _ in range(int(input()))))
n  = int(input())
a = list(map(int,input().split()))
res = [0]*(n+1)
for i in a:
    res[i]+=1
for i in range(1,n+1):
    print(res[i])

Submission status: Accepted

Solution code:
import numpy as np


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

    counter = np.zeros(N)
    for a in A:
        counter[a - 1] += 1

    for c in counter:
        print(int(c))


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
pepole = int(input())

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

workerList = {}

for single in range(pepole):
  workerList[single + 1] = 0

for single in range(len(boss)):
  workerList[boss[single]] += 1

for single in range(len(workerList)):
  print(workerList[single + 1])

Submission status: Accepted

Solution code:
from collections import Counter, deque
n = int(input())
a = deque(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:
#coding:utf-8
n = int(input())
a = input().split()
lis = [0 for i in range(n)]

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

for i in lis:
    print("{}".format(i))

Submission status: Accepted

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

ans = [0] * N

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for i in a:
    d[i] += 1
for j in range(1, n+1):
    print(d.get(j, 0))

Submission status: Accepted

Solution code:
def void(arg_num):
    return arg_num

def get_input_list(func=void):
    inp_str = input()
    return list(map(func, inp_str.split(" ")))


N = int(input())
a_list = get_input_list(int)

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

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

for ans in ans_list:
    print(ans)

Submission status: Accepted

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

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

for subordinate in b:
    print(subordinate)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# 初期入力
N = int(input())
A = list(map(int, input().split()))

#
from collections import Counter
jousi_0 = {i:0 for i in range(1,N+1)} # 上司の人数を０で初期化
jousi = Counter(A) # 上司の人数

for i,v in jousi.items(): # 0人も含めて数える
    jousi_0[i] = v

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

Submission status: Accepted

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

d = {}
for i in range(0,n-1):
  if a[i] in d:
    d[a[i]] += 1
  else:
    d[a[i]] = 1
    
for i in range(1,n+1):
  if i in d.keys():
    print(d[i])
  else:
    print(0)

Submission status: Accepted

Solution code:
import collections

n = int(input())
l_a = list(map(int, input().split()))
k_a = collections.Counter(l_a)

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

Submission status: Accepted

Solution code:
from collections import defaultdict

N = input()
M = input().split()

a = defaultdict(int)
for i in M:
    a[int(i) - 1] += 1

for i in range(int(N)):
    print(a[i])

Submission status: Accepted

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

Submission status: Accepted

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

i = 0
for target_val in range(1, n + 1):
    cnt = 0
    while target_val == a_list[min(i, len(a_list) - 1)] and i < len(a_list):
        i += 1
        cnt += 1
    print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import collections
N = int(input())
A = [int(i) for i in input().split()]
c = collections.Counter(A)
c = c.most_common()
c.sort()
cnt = 0
for i in range(N):
  try:
    num = c[cnt][0]
    tmp = c[cnt][1]
    if num == i+1:
      print(tmp)
      cnt += 1
    else:
      print(0)
  except:
    print(0)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
A = np.asarray(list(map(int,input().split())))
A_sort = np.sort(A)
# print(A_sort)
k = 0
for i in range(1,N+1):
    count = 0
    for j in range(k,N-1):
        if A_sort[j] == i:
            count += 1
        else:
            break
    print(count)
    k += count

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(b)

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

Submission status: Accepted

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

Submission status: Accepted

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

ans=[0]*(len(A)+1)


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

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

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

Submission status: Accepted

Solution code:
def main():
    from collections import Counter
    N = int(input())
    A_list = [A for A in input().split()]
    A_list = list(map(int, A_list))
    #ans_list = []
    ans = Counter(A_list)

    for n_cycle in range(N) :
        n_cycle = n_cycle + 1
        #ans_list.append(A_list.count(n_cycle))
        print(ans[n_cycle])

if __name__ == '__main__':
    main()

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 numpy as np


def solve():
    num_so = np.array([0] * (len(a)+1))
    so = [[] for i in range(len(a)+1)]
    for i in reversed(range(len(a)+1)):
        num_so[i] = len(so[i])
        if i!=0:
            chief = a[i-1]-1
            so[chief].append(i)
            #so[chief].extend(so[i])
    #print(so[-1])
    for nu in num_so:
        print(nu)
    return




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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
  n=int(input())
  a=list(map(int,input().split())) #横一列リスト
  ans=[0]*n
  for i in a:
    tmp=int(i)-1
    ans[tmp]=ans[tmp]+1
  for j in range(n):
    print(ans[j])
main()

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

Submission status: Accepted

Solution code:
import collections

def main(N, A):
    c = collections.Counter(A)
    [print(c[i+1]) for i in range(max(c.keys()))]
    [print(0) for i in range(max(c.keys()), N)]

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    # N = 7
    # A = list(map(int, "1 2 3 4 5 6".split()))
    main(N, A)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
L = np.zeros(N)
for x in A:
    L[x-1] += 1
for y in L:
    print(int(y))

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
n = int(input()) 
l = sorted(list(map(int, input().split())))
c = collections.Counter()
c.update(l)
[print(c[i]) for i in range(1, n+1)]

Submission status: Accepted

Solution code:
from collections import Counter

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

res = Counter(A)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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:
def main():
    N = int(input())
    A = list(map(int, input().split()))

    import collections

    C = collections.Counter(A)
    m = max(A)
    for i in range(m):
        print(C[i+1])

    for _ in range(N-m):
        print(0)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

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


counter = Counter(b)
list = ""
for i in range(a+1):
  if i == 0:
    list = list
  elif i>=1:
    list += str(counter[i])+"\n"

print(list)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
List = list(set(A))
ans = []

for k in range(N):
    ans.append(0)

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

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

Submission status: Accepted

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

L = []
for i in range(N):
  L.append(0)

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

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

Submission status: Accepted

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

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

tmp = ar.pop(0)
ar.append(tmp)
for i in range(n):
    print(ar[i])

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    sub = [0]*N

    for i in range(N-1):
        sub[A[i]-1] += 1
    print(*sub,sep='\n')
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N - 2 + 1)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    n = int(input())
    a_li = list(map(int, input().strip().split()))

    a_dict = {}

    for a in a_li:
        if str(a) in a_dict:
            a_dict[str(a)] += 1
        else:
            a_dict[str(a)] = 1

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
data = Counter(list(map(int, input().split())))
for i in range(1, N + 1):
    print(data[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 range(n):
  print(ans[j])

Submission status: Accepted

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

h = [0] * n
for i in l:
    h[i - 1] += 1

for i in h:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
dpa = defaultdict(lambda: 0)

n = int(input())

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

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

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

Submission status: Accepted

Solution code:
a=input()
b=input()

N=int(a)
An=b.split(' ')

import numpy as np
C=np.zeros(N+1)
for ai1 in An:
    C[int(ai1)] += 1

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

Submission status: Accepted

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

c = Counter(a)
for i in range(n):
    print(c[i + 1])

Submission status: Accepted

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

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

for i in cnt:
    print(i)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    (n, ) = [int(e) for e in lines[0].split(" ")]
    a = [int(e) for e in lines[1].split(" ")]

    return (n, a)


def solve(n, a):

    result = dict([(i, 0) for i in range(1, n+1)])

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

    return  list(result.values())


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Accepted

Solution code:
import math

class abc_163:
    
    def __init__(self):
        pass
    
    def A(self):
        r=int(input())
        print(2*math.pi*r)
    
    def B(self):
        NM=list(map(int,input().split()))
        A=list(map(int,input().split()))
        
        if NM[0]-sum(A)>=0:print(NM[0]-sum(A))
        else:print("-1")
    
    def C(self):
        N=int(input())
        A=list(map(int,input().split()))
        ans_list=[0]*(N+1)
        
        for i in range(N-1):ans_list[A[i]] +=1
        for i in range(1,N+1):print(ans_list[i])
    
if __name__=='__main__':
    obj=abc_163()
    obj.C()