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()))
memo = {}
for i in range(n - 1):
    if a[i] not in memo:
        memo[a[i]] = 1
    else:
        memo[a[i]] += 1
        
for i in range(n):
    if i + 1 in memo:
        print(memo[i + 1])
    else:
        print(0)

Submission status: Accepted

Solution code:
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v):
    print(["Yes", "No"][not v])


# エントリーポイント
def main():
    N = input(int)
    A = input([int, N - 1])
    ans = [0] * N
    for a in A:
        ans[a - 1] += 1
    for a in ans:
        print(a)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#初期値が0の辞書
from collections import defaultdict
cnt = defaultdict(lambda: 0) 

for item in a:
    cnt[item]+=1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque, Counter
from operator import itemgetter
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    n = int(input())
    A = list(map(int, input().split()))
    ans = [0] * n
    for a in A:
        ans[a-1] += 1
    for a in ans:
        print(a)




if __name__ == '__main__':
    main()

Submission status: Accepted

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

bb = [0]*n

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

for x in bb:
    print(x)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

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

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

Submission status: Accepted

Solution code:
n = int(input())
a_array = [int(x) for x in input().split()]
res_array = [0 for x in range(n + 1)]
for a in a_array:
    res_array[a] += 1
for r in res_array[1:]:
    print(r)

Submission status: Accepted

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

cnt = [0] * (n + 1)
for e in a:
    cnt[e] += 1

print(*cnt[1:], sep="\n")

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
n = int(input())
#n, m = map(int, sys.stdin.readline().split())
#s = input()
a = list(map(int, sys.stdin.readline().split()))

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

Submission status: Accepted

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

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

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

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

    for a in ans:
        print(a)


if __name__ == "__main__":
    solve()

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

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:
#MLE注意！ not は使わず !=

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

N = ni()
A  = nl()

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

for i in BUKA:
    print(i)

Submission status: Accepted

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

g = [[] for _ in range(n)]

for i in range(n-1):
    g[a[i]-1].append(i)

for i in g:
    print(len(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:
import math

N = int(input())
As = list(map(int, input().split()))
anss = [0] * (N + 1)
for a in As:
    anss[a] += 1
for ans in anss[1:]:
    print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    aa=LI()
    cnt=[0]*(n+1)
    for a in aa:cnt[a]+=1
    for i in range(1,n+1):
        print(cnt[i])

main()

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
ans = [0 for _ in range(N)]
for i in range(N-1):
    ans[A[i]-1] += 1
print(*ans, sep="\n")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

a = l()

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N = Scanner.int()
    A = Scanner.map_int()
    M = [0 for _ in range(N)]
    for a in A:
        M[a - 1] += 1
    print(*M, sep='\n')


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    ans=[0]*N
     
     
    for i in range(N-1):
        ans[A[i]-1]+=1
        
    for i in range(N):
        print(ans[i])

main()

Submission status: Accepted

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

sup = [0] * n

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

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

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

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

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

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from heapq import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l) + 1
	d = dict(Counter(l))
	for i in range(1,n+1):
		if(i in d):
			print(d[i])
		else:
			print(0)

	

N = int(stdin.readline())
l = list(map(int, stdin.readline().rstrip().split()))
ans = solve(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def submit():
    n = int(input())
    cnt = {i + 1: 0 for i in range(n)}
    
    for a in map(int, input().split()):
        cnt[a] += 1
    
    for a in range(1, n + 1):
        print(cnt[a])


submit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

N, *A = map(int, open(0).read().split())

ctr = Counter(A)
for i in range(1, N + 1):
    print(ctr[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:
def main():
    n = int(input())
    a = list(map(int, input().split()))

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

    for x in ans:
        print(x)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

for a in ansl:
    print(a)

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,*A = get_all_int()

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

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

Submission status: Accepted

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



for b in li:
    print(b)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI_()
    buka = [0 for i in range(N)]
    for i, a in enumerate(A):
        buka[a] += 1
    for b in buka:
        print(b)



main()

Submission status: Accepted

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

d = defaultdict(int)

for i in range(len(a)):
    d[a[i]] += 1

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

Submission status: Accepted

Solution code:
def input_one_number():
    return int(input())

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

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


N = input_one_number()
A = input_multiple_number_as_list()

ans = [0] * N

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

for anss in ans:
 	print(anss)

Submission status: Accepted

Solution code:


n = int(input())

B = [0] * n

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


for x in B:
    print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

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:
from collections import *
import sys
try: inp = raw_input
except: inp = input
def err(s):
    sys.stderr.write('{}\n'.format(s))

def ni():
    return int(inp())

def nl():
    return [int(_) for _ in inp().split()]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n = int(input())
a = [int(item) for item in input().split()]
ans = [0] * n

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

for item in ans:
    print(item)

Submission status: Accepted

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

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

for b in B:
    print(b)

Submission status: Accepted

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

N, *A = map(int, read().split())
out_deg = [0] * (N + 1)
for x in A:
    out_deg[x] += 1

print('\n'.join(map(str, out_deg[1:])))

Submission status: Accepted

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

print('\n'.join(str(i) for i in ans))

Submission status: Accepted

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

Submission status: Accepted

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

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = [a-1 for a in LIST()]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import collections


sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    c = collections.Counter(A)

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

    
    

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    a = list(map(int, readline().split()))
    ans = [0] * (n + 1)

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

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


if __name__ == '__main__':
    main()

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

b = [0] * n

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

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

Submission status: Accepted

Solution code:
import collections

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

CNT = collections.Counter(A)

for i in range(N):
    ctr = CNT[i + 1]
    print(ctr)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

for ans in ans_array:
    print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    *a, = map(int, input().split())

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


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


def main():
    N = int(input())
    A = list(map(lambda x: int(x) - 1, input().split()))
    S = [[] for _ in range(N)]
    for i in range(N - 1):
        S[A[i]].append(i + 2)

    for s in S:
        print(len(s))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

for cnt_i in cnt:
    print(cnt_i)

Submission status: Accepted

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

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

for i in l:
    print(i)

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

N = I()
A = LI()

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

PL(ns)

Submission status: Accepted

Solution code:
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    N = II()
    A = LMIIS()
    num_buka = defaultdict(int)
    for a in A:
        num_buka[a] += 1
    for i in range(1,N+1):
        print(num_buka[i])


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:
n=int(input())
l=list(map(int,input().split()))
from collections import *
c=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()))
C = [0]*n
for a in A:
    C[a-1] += 1
print(*C, sep="\n")

Submission status: Accepted

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

D = [0]*N

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = [int(x) - 1 for x in input().split()]
    answer = {i: 0 for i in range(n)}
    for aa in a:
        answer[aa] += 1
    for i in range(n):
        print(answer[i])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0] * n
for i in a:
    ans[i - 1] += 1
print("\n".join(map(str,(ans))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
A = list(map(int,input().split()))
data = [0] * n
for ai in A:
  ai -= 1
  data[ai] += 1
for di in data:
  print(di)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N = int(input())
A = inputlist()
from collections import Counter
c = Counter(A)
for i in range(1,N+1):
    print(c[i])

Submission status: Accepted

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