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


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    A_arr = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = collections.Counter(A_arr)
    for i in range(N):
        print(cnt[i+1])
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Submission status: Accepted

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)];rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

show_flg=False
show_flg=True

ans=0

n=I()
a=LI()
b=[0]*(n+1)
for i in a:
    b[i]+=1
for i in range(1,n+1):
    print(b[i])

#print(ans%mo)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(_) for _ in 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()))

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

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

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

Submission status: Accepted

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

ans = {}
for a in A:
    tmp = ans.get(a)
    # print(tmp)
    if tmp == None:
        ans[a] = 1
    else:
        ans[a] = tmp + 1

# print(ans)

for i in range(N):
    tmp = ans.get(i + 1)
    if tmp == None:
        tmp = 0
    print(tmp)

# for a in list(ans.keys()):
#     print()
# for a in ans:
#     print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N = int(input())
A = [int(v) for v in 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())
buka = [[] for _ in range(n)]
a = [int(x) for x in input().split()]

for i in range(n-1):
    # 社員 i の上司が a[i]-1
    buka[a[i]-1].append(i+1)

for i in range(n):
    print(len(set(buka[i])))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import Counter

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

A = Counter(A)

for i in range(1, N+1):
    print(A.get(i, 0))

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

from collections import Counter
ca = Counter(a)

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

Submission status: Accepted

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

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

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

for i in range(N):
  print(L[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:
import collections

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

c = collections.Counter(A)

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

Submission status: Accepted

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

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A_list = [int(a) for a in input().split()]
ans = {i: 0 for i in range(1, N+1)}
for a in A_list:
    ans[a] += 1

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

Submission status: Accepted

Solution code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

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

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    sup = {}
    for i in range(n-1):
        if a[i] in sup:
            sup[a[i]] += 1
        else:
            sup[a[i]] = 1
    for j in range(1, n+1):
        if j in sup:
            print(sup[j])
        else:
            print(0)
resolve()

Submission status: Accepted

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

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

for ans in answers:
    print(ans)

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
l=[0 for i in range(n)]
for i in a:
    l[i-1]+=1
print('\n'.join(map(str,l)))

Submission status: Accepted

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

bu = [0]*(N+1)
for i in range(N-1):
  bu[a[i]]+= 1
for b in range(1,len(bu)):
  print(bu[b])

Submission status: Accepted

Solution code:
"""
Author    : co_devil Chirag Garg
Institute : JIIT
"""
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
# from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
# from bisect import bisect_left,bisect_right
# from decimal import *,threading
from fractions import Fraction
# mod = int(pow(10, 9)+7)
mod = 998244353


def ii(): return int(input())


def si(): return str(input())


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


def li(): return list(mi())


def fii(): return int(stdin.readline())


def fsi(): return str(stdin.readline())


def fmi(): return map(int, stdin.readline().split())


def fli(): return list(fmi())


abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12,
       'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24,
       'z': 25}


def getKey(item): return item[0]


def sort2(l): return sorted(l, key=getKey)


def d2(n, m, num): return [[num for x in range(m)] for y in range(n)]


def isPowerOfTwo(x): return (x and (not (x & (x - 1))))


def decimalToBinary(n): return bin(n).replace("0b", "")


def ntl(n): return [int(i) for i in str(n)]


def powerMod(x, y, p):
    res = 1
    x %= p
    while y > 0:
        if y & 1:
            res = (res * x) % p
        y = y >> 1
        x = (x * x) % p
    return res


graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000


def bfs(d, v):
    q = []
    q.append(v)
    visited[v] = 1
    while len(q) != 0:
        x = q[0]
        q.pop(0)
        for i in d[x]:
            if visited[i] != 1:
                visited[i] = 1
                q.append(i)
        print(x)


def make_graph(e):
    d = {}
    for i in range(e):
        x, y = mi()
        if x not in d:
            d[x] = [y]
        else:
            d[x].append(y)
        if y not in d:
            d[y] = [x]
        else:
            d[y].append(x)
    return d


def gr2(n):
    d = defaultdict(list)
    for i in range(n):
        x, y = mi()
        d[x].append(y)
    return d


def connected_components(graph):
    seen = set()

    def dfs(v):
        vs = set([v])
        component = []
        while vs:
            v = vs.pop()
            seen.add(v)
            vs |= set(graph[v]) - seen
            component.append(v)
        return component

    ans = []
    for v in graph:
        if v not in seen:
            d = dfs(v)
            ans.append(d)
    return ans


def primeFactors(n):
    s = set()
    while n % 2 == 0:
        s.add(2)
        n = n // 2
    for i in range(3, int(sqrt(n)) + 1, 2):
        while n % i == 0:
            s.add(i)
            n = n // i
    if n > 2:
        s.add(n)
    return s


def find_all(a_str, sub):
    start = 0
    while True:
        start = a_str.find(sub, start)
        if start == -1:
            return
        yield start
        start += len(sub)


def SieveOfEratosthenes(n, isPrime):
    isPrime[0] = isPrime[1] = False
    for i in range(2, n):
        isPrime[i] = True
    p = 2
    while (p * p <= n):
        if (isPrime[p] == True):
            i = p * p
            while (i <= n):
                isPrime[i] = False
                i += p
        p += 1
    return isPrime


def dijkstra(edges, f, t):
    g = defaultdict(list)
    for l, r, c in edges:
        g[l].append((c, r))

    q, seen, mins = [(0, f, ())], set(), {f: 0}
    while q:
        (cost, v1, path) = heappop(q)
        if v1 not in seen:
            seen.add(v1)
            path = (v1, path)
            if v1 == t:
                return (cost, path)

            for c, v2 in g.get(v1, ()):
                if v2 in seen:
                    continue
                prev = mins.get(v2, None)
                next = cost + c
                if prev is None or next < prev:
                    mins[v2] = next
                    heappush(q, (next, v2, path))
    return float("inf")


def binsearch(a, l, r, x):
    while l <= r:
        mid = l + (r-1)//2
        if a[mid]:
            return mid
        elif a[mid] > x:
            l = mid-1
        else:
            r = mid+1
    return -1


# def input():
#    return stdin.buffer.readline()


def readTree(n):
    adj = [set() for _ in range(n)]
    for _ in range(n-1):
        u, v = map(int, input().split())
        adj[u-1].add(v-1)
        adj[v-1].add(u-1)
    return adj


def treeOrderByDepth(n, adj, root=0):
    parent = [-2] + [-1]*(n-1)
    ordered = []
    q = deque()
    q.append(root)
    depth = [0] * n
    while q:
        c = q.popleft()
        ordered.append(c)
        for a in adj[c]:
            if parent[a] == -1:
                parent[a] = c
                depth[a] = depth[c] + 1
                q.append(a)
    return (ordered, parent, depth)


# n, k = map(int, input().split())
# adj = readTree(n)
# ordered, parent, depth = treeOrderByDepth(n, adj)
# # children = [0]*n
# # for nd in ordered[::-1]:
# #     if parent[nd] != -2:
# #         children[parent[nd]] += children[nd] + 1
# # value = list(map(lambda a, b: a - b, depth, children ))
# # value.sort(reverse=True)
# # print(sum(value[:k]))
# print(ordered, parent, depth)

n = ii()
l = li()
out = [0]*(n+1)
for i in l:
    out[i] += 1
for i in range(1, (n+1)):
    print(out[i])

Submission status: Accepted

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

ans = {i: 0 for i in range(n)}

for i in range(n-1):
    ans[A[i]-1] += 1
for k, v in ans.items():
    print(v)

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:
import collections
N = int(input())
A = list(map(int , input().split()))
S = []
c = collections.Counter(A)
for i in range (N):
    S.append(c[i + 1])
for j in range(N):
    print(S[j])

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    arr = [int(x) - 1 for x in input().split()]
    res = [0 for _ in range(N)]
    for elem in arr:
        res[elem] += 1
    for ans in res:
        print(ans)

Submission status: Accepted

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

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:
import sys
sys.setrecursionlimit(100000)

def ins(): return input().split()
def ii(): return int(input())
def iil(): return list(map(int, ins()))
def lin(): return list(input())
def iin(): return map(int, ins())

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

Submission status: Accepted

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

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

for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    R = [[] for _ in range(N + 1)]
    for i, a in enumerate(A, 2):
        R[a].append(i)
    print('\n'.join(str(len(i)) for i in R[1:]))
main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

for d in c:
    print(d)

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int(): return int(input())

def map_int_input(): return map(int, input())

MII = map_int_input

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

def MII_to_index(): return map(to_index, input())

def MII_split_to_index(): return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs(): return list(map(int, input()))

LII = list_int_inputs

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

# 2次元リスト化
def LII_2D(rows_number): return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number): return [LII_split() for _ in range(rows_number)]

N = int(input())
As = LII_split()

subordinates = dict()
for i in range(N):
    subordinates[i] = 0

for A in As:
    subordinates[A-1] += 1

print_list_in_2D(list(subordinates.values()))

Submission status: Accepted

Solution code:

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * N
for a in A:
    cnt[a-1] += 1
for c in cnt:
    print(c)

Submission status: Accepted

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

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

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:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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



main()

Submission status: Accepted

Solution code:
N = int(input())

AList = list(map(int, input().split()))
ResultList = [0 for i in range(N)]
for i in range(N - 1):
    ResultList[AList[i] - 1] += 1

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

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

l = [0]*N

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

[print(i) for i in l]

Submission status: Accepted

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

N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
k = set(A)
r = set(range(1, N + 1))

for key in r - k:
    c[key] = 0


for key in r:
    print(c[key])

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

res = [0]*N
for val in a:
    res[val-1] += 1
for i in range(N):
    print(res[i])

Submission status: Accepted

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

junior = [0] * N

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

for j in junior:
    print(j)

Submission status: Accepted

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

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline

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

ans = [0 for _ in range(n)]
for a_i in a:
    ans[a_i - 1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

B_list = [0] * N

for i in range(N-1):
    B_list[A_list[i] - 1] += 1

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

Submission status: Accepted

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

a_result = [0] * n

for i in range(n-1):
    upper = a_l[i]-1
    a_result[upper] += 1

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

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

Submission status: Accepted

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

ans = [0 for _ in range(len(A) + 1)]

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

for a in ans:
    print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import collections

def set_debug(debug_mode=False):
    if debug_mode:
        fin = open('input.txt', 'r')
        # fout = open('output.txt', 'w')

        sys.stdin = fin
        # sys.stdout = fout


if __name__ == '__main__':
    # set_debug(True)

    n = int(input())

    res = list(map(int, input().split()))
    nei = collections.defaultdict(list)
    for i, x in enumerate(res, 2):
        nei[x].append(i)

    q = collections.deque()
    q.append(1)

    count = [0] * (len(res)+1)

    while q:
        for _ in range(len(q)):
            cur = q.popleft()
            for x in nei[cur]:
                count[cur-1] += 1
                q.append(x)
                
    for x in count:
        print(x)

Submission status: Accepted

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

a_dic = Counter(a_inputs)
for i in range(n):
    print(a_dic[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

    c = collections.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()))

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

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

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

Submission status: Accepted

Solution code:
from math import *
from collections import *
test = 1
#test = int(input())
for __ in range(test):
	n = int(input())
	a = list(map(int,input().split()))
	d = Counter(a)
	for i in range(1,n+1):
		if i not in d:
			print(0)
		else:
			print(d[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

d = {i: 0 for i in range(n)}

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())
A=[int(i) for i in input().split()]
dd=defaultdict(int)
for a in A:
    dd[a]+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

n = int(input().strip())

arr = list(map(int, input().strip().split()))

counts = collections.Counter(arr)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env/ python3
#S = input()
N = int(input())
#A, B, C = input().split()
#N, M = map(int, input().split())

#N = int(input())
A = [int(x) for x in input().split()]
B = [0] * N
#H, W = map(int, input().split())
#S = [input() for _ in range(H)]
#print(2*R*3.14159265)

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

P = [[] for _ in range(N)]
for i in range(N-1):
    jousi = A[i]-1
    P[jousi].append(i+1)

for v in P:
    print(len(v))

Submission status: Accepted

Solution code:
def solve():
  n = int(input())
  a = list(map(int, input().split()))
  josi = [0]*n
  for i in range(n-1):
    if a[i] != 0:
      josi[a[i]-1] += 1
  for i in josi:
    print(i)
  return 0
 
if __name__ == "__main__":
  solve()

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):
    if C.get(i+1) is not None:
        print(C[i+1])
    else:
        print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

for r in res:
    print(r)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a in 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()))
bs=[0 for _ in range(n)]
for x in a:
    bs[x-1]+=1


for x in bs:
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

answer_dic={}
for a in alist:
  if a in answer_dic:
    answer_dic[a]+=1
  else:
    answer_dic[a]=1
#print(answer_dic)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
c = Counter(A)
for i in range(1,N+1):
    print(c[i])

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