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

Submission status: Accepted

Solution code:
def resolve():
    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)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
lCnt = {}
for n in range(N):
  i = n + 1
  lCnt[i] = 0
i = 2
for n in input().split():
  Ai = int(n)
  lCnt[Ai] += 1
  i += 1
for n in lCnt:
  print(lCnt[n])

Submission status: Accepted

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

ans = [0] * n

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

for v in ans:
    print(v)

Submission status: Accepted

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

res = [0]*n
for a in al:
    res[a-1] += 1

for r in res:
    print(r)

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0] * (n+1)

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
Lis = [0]*N
for T in range(0,N-1):
    Lis[A[T]-1] = Lis[A[T]-1]+1
print('\n'.join(map(str,Lis)))

Submission status: Accepted

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

ans = [0]*n

for i in l:
  ans[i-1]+=1
  
for j in ans:
  print(j)

Submission status: Accepted

Solution code:
import sys
import collections
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    cnt = collections.Counter(a)
    for i in range(1, n+1):
        print(cnt[i])

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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=input().split()
A=[]
for _ in a:
    A.append(int(_))
E=[0]*(N+1)

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

for j in range(1,len(E)):
    print(E[j])

Submission status: Accepted

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

# 部下の数を入れるリスト
sub_num = []
for i in range(n+1):
    sub_num.append(0)

#
for i in range(n-1):
    index = a[i]
    sub_num[index] += 1

for i in range(1, n+1):
    print("{}".format(sub_num[i]))

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

Submission status: Accepted

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

en = [0]*N
for i in p:
    en[i-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
l = [0] * (N+1)  # 0は利用しない
A = map(int,input().split())
for a in A:
    l[a] +=1
    
for i in range(N):
    print(l[i+1])

Submission status: Accepted

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

Submission status: Accepted

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

l = len(a)+1 #社員数

sub = [0] * l

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

ans = '\n'.join(map(str,sub)) #これで改行区切り出力

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
c = [0] * (n + 1)
for i, j in enumerate(map(int, input().split())):
    i += 2
    c[j] += 1
print(*c[1:], sep='\n')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(k)

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

Submission status: Accepted

Solution code:
N = int(input())
emp = list(map(lambda x:int(x) - 1, input().split()))
ans = [0] * N

for e in emp:
    ans[e] += 1

for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

N = int(input())

c = collections.Counter([int(x) for x in input().split()])
for i in range(N):
    print(c[i+1])

Submission status: Accepted

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

for c in a:
    b[c-1] += 1

for d in b:
    print(d)

Submission status: Accepted

Solution code:
n = input().rstrip()
n = int(n)

a_i_inputs = input().rstrip().split(' ')
a_i_list = [int(i) for i in a_i_inputs[:n]]

output_list = [0 for _ in range(n)]

for a_i in a_i_list:
  output_list[a_i-1] += 1
  
for output in output_list:
  print(output)

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

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    men = [0 for _ in range(len(A)+1)]
    for i in range(len(A)-1, -1, -1):
        men[A[i]-1] += 1
    for m in men:
        print(m)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
n = int(input())
a = list(map(int, input().split()))
from collections import Counter
a_counter = dict(Counter(a))
for i in range(n):
    if i + 1 in a_counter:
        print(a_counter[i + 1])
    else:
        print('0')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(input().split())
A = [int(A[i]) for i in range(N-1)]
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:
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:
    print(C[i])
  else:
    print(0)

Submission status: Accepted

Solution code:
N=int(input())
p=list(map(int,input().split()))
li=[0]*N
for mem in p:
  li[mem-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 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()))
l=[0]*(n)

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
check=[False]*(n+1)

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

Submission status: Accepted

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

ans = [0]*(n+1)

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

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

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N    
  for i in range(N-1):
      B[A[N-i-2]-1] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
N = int(input())
# 社員番号1以外のN-1人分担当上司番号を入力する
A = list(map(int, input().split()))
# 出現回数を数えてくれる
count = collections.Counter(A)
for n in range(N):
#   数が足りないから+1する。
  print(count[n+1])

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in my_boss:
    num_subordinates[i-1] += 1

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

Submission status: Accepted

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

bosses = [0]

for i in info:
    num = int(i)
    bosses[num-1] += 1
    bosses.append(0)

for item in bosses:
    print(item)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from collections import Counter


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

c = Counter(a)

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

Submission status: Accepted

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


def resolve():
    a = read()
    result = think(a)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n - 1)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a):
    n = len(a) + 1
    boss = [0] * (n + 1)
    for b in a:
        boss[b] += 1
    return boss[1:]


def write(result):
    for r in result:
        print(r)


if __name__ == '__main__':
    # unittest.main()
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heapify, heappop, heappush
N = int(input())
A = list(map(int, input().split()))
heapify(A)
for i in range(1, N + 1):
    curr_cnt = 0
    if len(A) > 0:
        temp = heappop(A)
        if i == temp:
            while i == temp and (len(A) > 0):
                curr_cnt += 1
                temp = heappop(A)
            if i == temp:
                curr_cnt += 1
            else:
                heappush(A, temp)
        else:
            heappush(A, temp)
    print(curr_cnt)

Submission status: Accepted

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

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

for i in manager:
    print(i)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
import collections

n = int(input())
l = list(map(int, input().split()))
c = collections.Counter(l)

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

Submission status: Accepted

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

sup = [0] * N

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

n=int(input())
a=(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()))

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

boss_dict = {i+1:0 for i in range(N)}
for i in range(N-1):
    boss = A_list[i]
    boss_dict[boss] += 1

for k, v in boss_dict.items():
    print(v)

Submission status: Accepted

Solution code:

n = int(input())
l = list(map(int,input().split()))
l.sort()
k = 0
j = 1
cnt = 0
for i in range(n):
    if i == n-1:
        print(cnt)
        for _ in range(n - j):
            print(0)
    elif j == l[i]:
        cnt += 1
    elif l[i] - j >= 1:
        print(cnt)
        cnt = 1
        a = l[i] - j
        for _ in range(a-1):
            print(0)
        j += l[i] -j

Submission status: Accepted

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

l = [0]*n
for i in a: l[i-1] += 1
print(*l, sep='\n')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

m = [0] * n

for i in a:
  m[i-1] += 1
  
m = map(str, m)
print('\n'.join(m))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
memo = {key:0 for key in range(1, N+1)}

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

sum =[0] * N

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

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

Submission status: Accepted

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

B = [0 for i in range(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()))

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

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

Submission status: Accepted

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

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

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

for s in sub:
    print(s)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N=int(input())

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

A=[0]
array=list(map(int,input().split()))
for i in range(len(array)):
    A.append(array[i]) 

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

for i in sub:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

for j in x:
    print(j)

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
print(*ans,sep="\n")

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

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()))
b=[0]*n

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

[print(i) for i in b]

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

Solution code:
n = input()
n=int(n)
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:
import collections
n = int(input())
a = [int(i) for i in input().split()]
cnt = collections.Counter(a)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(n):
    boss_list.append(0)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict

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

c = defaultdict(int)
for i, a in enumerate(A):
	c[a] += 1

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

Submission status: Accepted

Solution code:
import collections

num_of_employee = int(input())
employeenos = list(map(int, input().split()))

c = collections.Counter(employeenos)
for i in range(1, num_of_employee + 1):
    print(c[i])

Submission status: Accepted

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

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
    
n = inp()
A = invr()

map = defaultdict(int)
for i, boss in enumerate(A, 2):
	map[boss] += 1 
	
for i in range(n):
	print map[i+1]

Submission status: Accepted

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

b = [0]*n

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

dic = [0]*n

for i in slist:
    dic[i-1] += 1
    
for i in dic:
    print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

l = [0]*n
i = 0
while i<n-1:
    l[a[i]-1]+=1
    i+=1

i=0
while i<n:
    print(l[i])
    i+=1

Submission status: Accepted

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

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

t = [print(i) for i in buka]

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
#n = range(N)
a = list(int(i) for i in input().split()) #A_i =: a_{i-2}

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

Submission status: Accepted

Solution code:
from collections import Counter

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = [0]
a.extend(list(map(int, input().split())))
cnt = {}
for i in range(n):
  cnt.setdefault(i, 0)
  if a[i] != 0 :
    cnt[a[i]-1] += 1

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

Submission status: Accepted

Solution code:
from collections import Counter

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from collections import Counter


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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
chief = list(map(int, input().split()))
sub = [0]*n
for i in range(n-1):
  c_num = chief[i] #i+2番目の社員の上司番号
  sub[c_num-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = [0] * N
for a in map(int, input().split()):
    ans[a - 1] += 1
print(*ans, sep='\r')

Submission status: Accepted

Solution code:
N = int(input())
ans = [0] * N
for a in map(int, input().split()):
    ans[a - 1] += 1
print(*ans, sep='\n\r')

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
Li = [[] for i in range(N)]
for i,joushi in enumerate(A):
  Li[joushi-1].append(i+2)
for i in range(N):
  print(len(Li[i]))

Submission status: Accepted

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


if __name__ == '__main__':
    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):
    print(c[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

for x in range(2,N+1):
    S[A[x-2]]+=1

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque

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

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

Submission status: Accepted

Solution code:
N = int(input())
values = list(map(int, input().split()))
values_dict = {}

for value in values:
    values_dict[value] = values_dict.get(value, 0) + 1
for i in range(1, N+1):
    print(values_dict.get(i, 0))

Submission status: Accepted

Solution code:
import collections
def resolve():
    N = int(input())
    strA = input().split()
    ans = collections.Counter(strA)
    for i in range(1,N+1):
        print(ans[str(i)])
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

for ans in anslst:
  print(ans)

print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
base = np.zeros(n)
a = np.array(list(map(int,input().split())))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    tcase = int(input())
    pcase = [ int(i) for  i in input().split(' ')]
    leng = len(pcase) + 1
    items = [0]*leng
    for i in pcase:
        items[i-1] +=1
    for i in items:
        print(i)

Submission status: Accepted

Solution code:
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#ans = [0]*n
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()))
m = [0]*N #0~N-1

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

Submission status: Accepted

Solution code:
N=int(input())
josi = list(map(int,input().split()))
count=[0]*N
n=0
while n<N-1:
  count[josi[n]-1] =count[josi[n]-1]+1
  n=n+1
n=0
while n<N:
  print(count[n])
  n=n+1