Problem:


Score : 300 points

Problem Statement

A company has N members, who are assigned ID numbers 1, ..., N.

Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.

When a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.

You are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq A_i < i

Input

Input is given from Standard Input in the following format:

N
A_2 ... A_N

Output

For each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.

Sample Input 1

5
1 1 2 2

Sample Output 1

2
2
0
0
0

The member numbered 1 has two immediate subordinates: the members numbered 2 and 3.

The member numbered 2 has two immediate subordinates: the members numbered 4 and 5.

The members numbered 3, 4, and 5 do not have immediate subordinates.

Sample Input 2

10
1 1 1 1 1 1 1 1 1

Sample Output 2

9
0
0
0
0
0
0
0
0
0

Sample Input 3

7
1 2 3 4 5 6

Sample Output 3

1
1
1
1
1
1
0



Sample input:
5
1 1 2 2


Sample output:
2
2
0
0
0

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

AnStr = input().split(' ')
zyosiList = []
a = {}
for v in AnStr:
  zyosiList.append(int(v))
  if v in a:
    a[v] += 1
  else:
    a[v] = 0

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
# import collections

# import bisect
# import math
import numpy as np

# from fractions import gcd

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    # n, m = ip.IL()
    # a = np.array(ip.IL())
    # for _ in range(m):
    #     a[np.argmax(a)] //= 2
    # print(np.sum(a))
    n = int(input())
    a = np.array(ip.IL())
    
    b = np.bincount(a)[1:]
    m = len(b)
    others = np.zeros(n-m).astype(int)
    # print(b, others)
    print('\n'.join(map(str, b)))
    print('\n'.join(map(str, others)))
    

main()

Submission status: Accepted

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

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

for i in b:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
M = int(input())
A = list(map(int, input().split()))
B = collections.Counter(A)
num = 1

while num <= M:
    print(B[num])
    num += 1

Submission status: Accepted

Solution code:
from collections import Counter


def main():
    N = int(input()) # 5人
    An = list(map(int, input().split(' '))) # A2, A3,...
    
    # N = 10
    # An = [1,1, 1, 1, 1, 1, 1, 1, 1]
    
    # out = [0] *
    
    an = Counter(An)
    for n in range(1, N+1):  
        print(an[n])
            


    
main()

Submission status: Accepted

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

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

print(*ans)

Submission status: Accepted

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

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

for j in range(0, N):
    print(M[j])
    j += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    A = list(map(int, rl().split()))
    
    counter = defaultdict(int)
    for ai in A:
        counter[ai] += 1
    for i in range(1, N + 1):
        print(counter[i])


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

N = int(input())

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

c = collections.Counter(A)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

n = int(input())
base = input().split()
x = []
for i in base:
    x.append(int(i))
#x.sort(reverse = False)
c = collections.Counter(x)
for i in range(1,n):
    print(c[i])
print(0)

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

def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    
    c = collections.Counter(A)
    
    for i in listN:
        print(c[i])
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i= int(input())
l=list(map(int, input().split()))
time=[]
for i in range(i):
  time.append([])
for i in l:
  
  time[i-1].append(i)
  
for i in time:

  print(len(i))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N = int(input())
A = list(map(lambda x: int(x)-1, input().split()))
dic = {}
for a in A:
    dic[a] = dic.get(a, 0)+1
for i in range(N):
    print(dic.get(i, 0))

Submission status: Accepted

Solution code:

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

buka = [0] * N

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

Submission status: Accepted

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

list = [0] * (N + 1)
for i in range(0, N - 1):
    a = P[i]
    list[a] += 1
for i in range(1, N + 1):
    print(list[i])

Submission status: Accepted

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

c = collections.Counter(a)
for value in range(n):
    if value == 0:
        continue
    else:
        print(c[value])
print(0)

Submission status: Accepted

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

ans=[0]*n
for i in li:
        ans[i-1] = ans[i-1] + 1
        
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    N = int(input())
    A = read_list()
    D = {}
    for a in A:
        D[a] = D.setdefault(a, 0) + 1
    
    for n in range(1, N + 1):
        print(D.setdefault(n, 0))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

mycounter = Counter(A)

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

Submission status: Accepted

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

c = collections.Counter(a)

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

Submission status: Accepted

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

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

print(0)

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
print('\n'.join(map(str, B)))

Submission status: Accepted

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

# import collections
# for i in range(1, n + 1):
#   print(collections.Counter(a)[i])

b = [0] * n

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

for f in b:
  print(f)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit, stdout
#setrecursionlimit(1000000)
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return list(mi())
def lsi():
    x=list(stdin.readline())
    x.pop()
    return x
def si(): return stdin.readline()
mod=1000000007
res=['YES', 'NO']
############# CODE STARTS HERE #############
n=ii()
p=[0]*(n+1)
a=li()
for i in a:
    p[i]+=1
for i in p[1:]:
    print(i)

Submission status: Accepted

Solution code:
import collections
n=int(input())
a=list(map(int,input().split()))
m=max(a)
c=collections.Counter(a)
c=c.most_common()
l=[0]*n
for i in range(len(c)):
    l[c[i][0]-1]=c[i][1]
print(l[0])
for j in range(1,n):
    print(l[j])

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())
a = list(int(i) for i in input().split())
lst = [0] * (n + 1)

for i in a:
    lst[i] += 1

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

Submission status: Accepted

Solution code:
l=[list(map(int,input().split())) for _ in range(2)]
managementlist=[]
for i in range(l[0][0]):
    managementlist.append(0)
for j in range(l[0][0]-1):
    managementlist[l[1][j]-1]+=1
for k in range(l[0][0]):
    print(managementlist[k])

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 m in buka:
    print(m)

Submission status: Accepted

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

boss_count_list = [0] * n


for val in boss_list:
  boss_count_list[val - 1] += 1

for val in boss_count_list:
  print(val)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = map(int, input().split())
s_dict = {i:0 for i in range(1, N+1)}
for s in S:
    s_dict[s] += 1
for i in range(1, N+1):
    print(s_dict[i])

Submission status: Accepted

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

dp = [0] * a
for i in l:
    dp[i-1]+=1
for i in dp:
    print(i)

Submission status: Accepted

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

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

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

for i in ans: print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
hoge = list(map(int, input().split()))

fuga = [0] * num

for i in hoge:
  fuga[i - 1] += 1
for i in fuga:
  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(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(1, N + 1):
    print(c[i])

Submission status: Accepted

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

import collections
c = collections.Counter(A)

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

Submission status: Accepted

Solution code:
n=int(input())
boss=[int(x) for x in input().split()]
mem=list(range(1, n+1))
h_map = dict.fromkeys(mem, 0)
for i in boss:
    h_map[i]+=1

for i in mem:
    print(h_map[i])

Submission status: Accepted

Solution code:
import numpy as np

num = int(input())
sup_num = list(map(int,input().split()))
yn_num = list(np.zeros(num,dtype=np.int16))

for x in sup_num:
  yn_num[x-1] +=1
for x in yn_num:
  print(x)

Submission status: Accepted

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

p = [0] * n

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

for i in p:
  print(i)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
a={}
for i in range(1,N+1):
  a.update({i:0})
for j in A:
  a[j]+=1
for k,l in a.items():
  print(l)

Submission status: Accepted

Solution code:
a=int(input())
b=list(map(int,input().split()))
c={}
for i in range(len(b)):
    try:
        c[b[i]]+=1
    except KeyError:
        c[b[i]]=1

    
for i in range(a):
    try:
        print(c[i+1])
    except KeyError:
        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]+=1

for i in ans:
    print(i)

Submission status: Accepted

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

import numpy as np
arr = np.array(A)-1
binc = np.bincount(arr)
binc.resize(N)
for s in binc:
    print(s)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
N = int(input())
A = [int(x) for x in input().split()]
cnt = [0] * 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=[int(c) for c in input().split()]

dic={}
for e in A:
    if e in dic:
        dic[e]+=1
    else:
        dic[e]=1
        
for i in range(1,N+1):
    if i in dic:
        print(dic[i])
    else:
        print(0)

Submission status: Accepted

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

Submission status: Accepted

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

C = collections.Counter(A)
#print(C)

for i in range(N):
  #print(A.count(i+1))
  print(C[i+1])

Submission status: Accepted

Solution code:
import sys
import os
import math

def file_input():
    f = open('input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()

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

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

    for i in N:
        print(i)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
data = [int(i) for i in input().split()]
ans = [0 for i in range(n)]
for who in data:
  ans[who-1] += 1
for num in ans:
  print(num)

Submission status: Accepted

Solution code:
#--management
from collections import Counter

member = int(input())
mem_number = [int(i) for i in input().split()]

ans = []

ans = [0] * member

mycounter = Counter(mem_number)

for i in range(member):
  ans[i] = mycounter[i+1]
  print(ans[i])

Submission status: Accepted

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

C = collections.Counter(t)
for i in range(N):
    print(C[i+1])

Submission status: Accepted

Solution code:
#200419C
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)

count = 0
for i in range(N-1):
    L = len(A)
    #print(A)
    Ans = 0
    count += Ans
    for j in range(L-count):
        if A[count + j]==i+1:
            Ans += 1
        else:            
            break
    print(Ans)
    count += Ans

        
print("0")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
n = int(input())
x = map(int, input().split())
a_list = list(x)

# n = 5
# a_list = [1,1,3,3]

r_list = collections.Counter(a_list)
y = []
for i in range(1,(n+1)):
    if (i in r_list):
        y.append(r_list[i])
    else:
        y.append(0)

r_list2 = map(str, y)
r_list2 = list(r_list2)
ans = "\n".join(r_list2)
print(ans)

# r_list = map(a_list.count, range(n+1))
#r_list = list(r_list_v)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in [int(s) for s in input().split()]:
    A[i-1] +=1

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

Submission status: Accepted

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

ans.pop(0)
for i in ans:
  print(i)

Submission status: Accepted

Solution code:
import sys

def main():

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

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

Submission status: Accepted

Solution code:
n = int(input())
dicti = {}
boss = list(map(int, input().split()))
for i in boss:
    if i in dicti:
        dicti[i] += 1
    else:
        dicti[i] = 1
#print(dicti)
for j in range(1,n+1):
    try:
        print(dicti[j])
    except:
        print(0)

Submission status: Accepted

Solution code:
import numpy
N = int( input())
a = list(map(int, input().split(' ')))
l = [0]*N
numpy.sort(a)
for i in a:
    l[i-1] += 1
for i in l:
    print(i)

Submission status: Accepted

Solution code:
import collections
n = int(input())
a = list(map(str,input().split())) #上司の社員番号

result = collections.Counter(a)

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

Submission status: Accepted

Solution code:
n=int(input())
boss=[int(x) for x in input().split()]
mem=list(range(1, n+1))
h_map = dict.fromkeys(mem, 0)
for i in boss:
  h_map[i]+=1
for i in mem:
  print(h_map[i])

Submission status: Accepted

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

res = [0] * n
for l in li:
  res[l-1] += 1

for r in res:
  print(r)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
jousi = list(map(int, input().split()))
a = np.zeros(n)
for i in range(len(jousi)) :
    a[jousi[i] - 1] += 1
for i in range(len(a)):
    print(int(a[i]))

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N = I()
A = LI()

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

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

Submission status: Accepted

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

for i, value in enumerate(a):
    b[value-1] += 1

for j in b:
    print(j) 

print('0')

Submission status: Accepted

Solution code:
import numpy as np
 
 
if __name__ == '__main__':
    List = [list(map(int, input().split())) for i in range(2)]
    N = List[0][0]
    buka = np.array(List[1][:])
 
 
    l_out = np.zeros(N,dtype=int)
 
    for i in range(N-1):
        l_out[buka[i]-1] += 1
 
    for i in range(N):
        print(l_out[i])

Submission status: Accepted

Solution code:
N = int(input())
A = input().split()
senior = [0]*N

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

for s in senior:
    print(s)

Submission status: Accepted

Solution code:
import collections

N = int(input())
A = list(map(str, input().split())) 
c = collections.Counter(A)  
for i in range(N):
    print(c["{}".format(i+1)])

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
l = list(map(int, input().split()))
counter = Counter(l)
for i in range(1, N+1):
    if i in counter.keys():
        print(counter[i])
    else:
        print(0)

Submission status: Accepted

Solution code:
import collections

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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] = li[a[i]-1] + 1

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

Submission status: Accepted

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

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

[print(j) for j in B]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def get_subordinate(n, members):
    new_dict = {}

    for i in range(1, n+1):
        new_dict[i] = 0

    for member in members:
        if member in new_dict:
            new_dict[member] += 1

    print(*new_dict.values(), sep="\n")


if __name__ == '__main__':
    n = int(input())
    members = list(map(int, input().rstrip().split()))
    get_subordinate(n, members)

Submission status: Accepted

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

#for i in range(0,n):
#  print (a.count(i+1))
#  a= [a[j] for j in range(0, len(a)) if a[j] != i+1]
#
#  print (a)

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

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))

rsl = np.zeros(n)

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

for i in range(n):
    print(int(rsl[i]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def function(n, list1):
  ans = [0] * n
  for i in list1:
    ans[i - 1] += 1
  string = ""
  for i in range(len(ans)):
    if i < len(ans) - 1:
      string += str(ans[i]) + "\n"
    else:
      string += str(ans[i])
  return string
 
n = int(input())
list1 = input().split()
list1 = [int(i) for i in list1]
print(function(n, list1))

Submission status: Accepted

Solution code:
import numpy as np

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

dst = np.zeros(n)
for i in range(n-1):
	dst[int(a[i])-1] += 1

for i in range(n):
	print(int(dst[i]))

Submission status: Accepted

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