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: Time Limit Exceeded

Solution code:
"""
// Author : snape_here - Susanta Mukherjee
     
 """
 
from __future__ import division, print_function
 
import os,sys
from io import BytesIO, IOBase
 
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
 
 
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())
 
 
def read():
    sys.stdin = open('input.txt', 'r')  
    sys.stdout = open('output.txt', 'w') 
 
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

mod=1000000007

import math

import bisect

abc="abcdefghijklmnopqrstuvwxyz"

def main():

    n=ii()
    a=li()
    for i in range(1,n+1):
        print(a.count(i))

        
# region fastio

 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
 
 
if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
 
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
 
if __name__ == "__main__":
    #read()
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

for i in range(N-1):
    #print(i, a[i]-1)
    l[a[i]-1] += 1
#print(l)
for j in range(N):
    print(l[j])

Submission status: Accepted

Solution code:
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())


n=int(input())
ar=lis()
temp=[0]*(n+5)
for i in range(n-1):
    #print(ar[i],temp)
    temp[ar[i]]+=1
for i in range(1,n+1):
    print(temp[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
dct = {}
A = list(map(int, input().split()))
for a in A:
    if a in dct.keys():
        dct[a] += 1
    else:
        dct[a] = 1
for n in range(1, N+1):
    print(dct.get(n, 0))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
import math
n = int(input())
c= [0]*n
s = map(int,input().split())

for i in s:
  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 for _ in range(n)]
for i in range(len(a)):
  c[a[i]-1]+=1
for j in range(len(c)):
  print(c[j])

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

bukas = [[]for i in range(a)]
for i in range(1,a):
    bukas[b[i-1]].append(i)
for c in bukas:
    print(len(c))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: x - 1, A))

bukas = [ [] for i in range(N) ]
for i in range(1, N):
    bukas[A[i-1]].append(i)

for b in bukas:
    print(len(b))

Submission status: Accepted

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

emp = [0]*(n+1)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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] ,end=" ")

Submission status: Accepted

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

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

print(0)

Submission status: Accepted

Solution code:
from collections import defaultdict
N=int(input())
A=list(map(int, input().split()))
dd=defaultdict(int)
for i in range(1, N+1):
	dd[i]+=0
	if i>=2:
		dd[A[i-2]]+=1
for k, v in dd.items():
	print(v)

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

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

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

Submission status: Accepted

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

count = collections.Counter(A)
ans = []

for i in range(1,N+1):
    ans.append(count[i])
    
    
[print(x) for x in ans]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i, x in enumerate(a):
  m[x] += 1

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

Submission status: Accepted

Solution code:
num = int(input())
table = list(map(int, input().split()))
table2 = []
for i in range(num):
    table2.append(0)
 
for j in range(len(table)):
    table2[table[j]-1] += 1
 
for k in table2:
    print(k)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for j in range(len(table)):
    table2[table[j]-1] += 1

for k in table2:
    print(k)

Submission status: Accepted

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

result = [0] * N

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

Submission status: Accepted

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

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

ans = [0] * N

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

Submission status: Accepted

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

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

for n in answer:
  print(n)

Submission status: Accepted

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

Submission status: Accepted

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

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

main()

Submission status: Accepted

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

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

for j in number_buka:
    print(j)

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

Submission status: Accepted

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

for a in ans:
    print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0] * n

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

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
# author:  Taichicchi
# created: 12.09.2020 19:50:20

from collections import Counter
import sys

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:
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
n = int(input())
A = list(map(int, input().split()))
b = [0]*(n+1)
for i in A:
    b[i]+=1
for i in range(1, n+1):
    print(b[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:
n = int(input())

a = [0 for _ in range(n-1)]
a = [int(s) for s in input().split()]

d = {}

for i in range(n-1):
    boss = a[i]
    d[boss] = d.setdefault(boss,0) + 1

for i in range(n):
    ans = d.setdefault(i+1,0)
    print(ans)

Submission status: Accepted

Solution code:
import sys

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

ans = [0] * N
for a_i in A:
    ans[a_i-1] += 1

for a in ans:
    print(a)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
A = list([int(x) for x in input().split()])

result = dict(Counter(A))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
G = {i:[] for i in range(1,N+1)}
A = list(map(int,input().split()))
A.insert(0,0)
A.insert(0,0)
for i in range(2,N+1):
    G[A[i]].append(i)
for i in range(1,N+1):
    print(len(G[i]))

Submission status: Accepted

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

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()))
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()))
#A.reverse()
ans = [0 for _ in range(N)]
for i in reversed(range(N-1)):
  #今i番目(0index)の社員
  boss = A[i]-1 #0index
  ans[boss] += 1
  #print(ans,i,boss)
for x in ans:
  print(x)

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

for m in ans:
    print(m)

Submission status: Accepted

Solution code:
# @uthor : Kaleab Asfaw
from sys import stdin, stdout
# Fast IO
# from math import gcd

def input():
	a = stdin.readline()
	if a[-1] == "\n": a = a[:-1]
	return a
def print(*argv, end="\n", sep=" "):
	n = len(argv)
	for i in range(n):
		if i == n-1: stdout.write(str(argv[i]))
		else: stdout.write(str(argv[i]) + sep)
	stdout.write(end)
# Others
mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def fact(x, mod=mod):
	ans = 1
	for i in range(1, x+1): ans = (ans * i) % mod
	return ans
def arr2D(n, m, default=0):
	lst = []
	for i in range(n): temp = [default] * m; lst.append(temp)
	return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}

def solve(n, lst):
	map1 = {}
	for i in lst:
		if map1.get(i) == None: map1[i] = 1
		else: map1[i] += 1
	for i in range(1, n+1):
		if map1.get(i) == None: print(0)
		else: print(map1.get(i))

n = int(input())
lst = list(map(int, input().split()))
solve(n, lst)

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 j in L:
    print(j)

Submission status: Accepted

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

for i in range(n-1) :
    res[A[i]].append(i)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import math
# import statistics
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
# e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

f.sort()
count=1
ans=[0 for i in range(a)]

for i in range(len(f)-1):
    if f[i]==f[i+1]:
        count+=1
    else:
        ans[f[i]-1]=count
        count=1
if count>=1:
    ans[f[-1]-1]=count
for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n-1):
    ans[a[i]]+=1
ans.pop(0)
for j in ans:
    print(j)

Submission status: Accepted

Solution code:
import copy
n=int(input())
A=list(map(int,input().split()))
L=[0]*n

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########
n=int(input())
d=defaultdict(int)
A=list(map(int,input().split()))

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

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

for b in buka:
  print(b)

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

for b in buka:
    print(b)

Submission status: Accepted

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

Submission status: Accepted

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

a = collections.Counter(A)

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

Submission status: Accepted

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

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:
n = int(input())
a = list(map(int,input().split()))
d = {}
for i in range(1,n+1):
    if i not in d:
        d[i] = 0

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:
N = int(input())
boss = [0] * N
A = map(lambda x:int(x) - 1, input().split())

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

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

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

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    s = [0 for _ in range(N)]
    for Ai in A:
        s[Ai - 1] += 1

    return "\n".join(map(str, s))


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
A_dict = {}
for a in A:
    if A_dict.get(a):
        A_dict[a] += 1
    else:
        A_dict[a] = 1
B = [0] * N
for i in range(N+1):
    if A_dict.get(i):
        B[i-1] = A_dict[i]
for b in B:
    print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
from collections import defaultdict
numsubs=defaultdict(int)
for sub in A:
    numsubs[sub]+=1
for k in range(N):
    print(numsubs[k+1])

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

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    a = list(map(lambda i:int(i)-1, input().split(" ")))
    d = {}
    for i in range(n):
        d[i]=0
    for i in range(n-1):
        d[a[i]] += 1
    for i in range(n):
        print(d[i])

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

k=collections.Counter(A)

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

Submission status: Accepted

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

ans_list = [0]*n
for boss in bosses:
    ans_list[boss-1] += 1

for ans in ans_list:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C - management

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

s = [0]*n
level = 1
al.sort()
for i in range(len(al)):
    if al[i] == level:
        s[level-1] += 1
    elif al[i] >= level:
        level = al[i]
        s[level-1] += 1

for j in s:
    print(j)

Submission status: Accepted

Solution code:
from collections import Counter

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

c = Counter(A)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    a_c = Counter(a)
    for i in range(1, n+1):
        ans = a_c.get(i)
        if ans:
            print(ans)
        else:
            print(0)
        
if __name__ == '__main__':
    main()

Submission status: Accepted

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

anslist = [0]*(N+1)
for i in range(len(Alist)):
  anslist[Alist[i]]+=1
#print (anslist)
for i in range(len(anslist)):
  if i!=0:
    print (anslist[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A_ls = map(int, input().split(' '))
    ls = [0] * N
    for i in A_ls:
        ls[i - 1] += 1
    for i in ls:
        print(i)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

p2 = [0]*n 

for x in p:
    p2[x-1] = p2[x-1] + 1

for x in p2:
    print(x)

Submission status: Accepted

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
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)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for ni in range(n):
  dic[ni+1] = 0
for ai in a:
  dic[ai] += 1
for di in dic:
  print(dic[di])

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))


d = {}
for num in a:
    d[num] = d.get(num, 0) + 1


for i in range(1, len(a)+2):
    if i in d:
        print(d[i])
    else:
        print(0)

Submission status: Accepted

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