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:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

n = INT()
a = LIST()
b = set(a)
c = Counter(a)
for i in range(1, n + 1):
    if not i in b:
        print(0)
    else:
        print(c[i])

Submission status: Accepted

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

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

for i in b:
    print(i)

Submission status: Accepted

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

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:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
    D[a] += 1

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

Submission status: Accepted

Solution code:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N = ii()
A = li()

l = [0]*N

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

for a in l:
    print(a)

Submission status: Accepted

Solution code:
import numpy as np
import math
from collections import defaultdict

d = defaultdict(int)

n = int(input())
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:
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

def main():
    n = int(input())
    a = readInt()
    m = {}
    for x in a:
        if x in m.keys():
            m[x] += 1
        else:
            m[x] = 1
    for i in range(1,n+1):
        if i in m.keys():
            print(m[i])
        else:
            print(0)
    return

if __name__=='__main__':
    main()

Submission status: Accepted

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

G = [[] for _ in [0]*N]

for i, a in enumerate(A):
    a -= 1
    b = i+1
    G[a].append(b)

for g in G:
    print(len(g))

Submission status: Accepted

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

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

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

for s in S:
    print(s)

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

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
count = [0] * n

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

for child, parent in enumerate(A, 1):
    count[parent-1] += 1

for c in count:
    print(c)

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:
# coding: utf-8

N = int(input())
A = list(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:
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right,insort_left,insort_right
from heapq import heapify,heappop,heappush
from copy import deepcopy
from itertools import accumulate,groupby,permutations,combinations
from math import ceil,sqrt,cos,sin,pi,gcd

N = int(input())
A = [int(i) - 1 for i in input().split()]

cnt = [0] * N

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

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

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

arr = [int(x) for x in input().split(" ")]

a = [0]*n

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

import collections

c = collections.Counter(A)


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

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N = I()
    A = LI()
    m = defaultdict(int)

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

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




if __name__ == '__main__':
    main()

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:
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

n = load()
A = load_list()

d = defaultdict(int)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


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


def main():
    N = int(input())
    A = list(map(int, input().split()))
    check = [0 for _ in range(N)]
    for a in A:
        check[a - 1] += 1
    for c in check:
        print(c)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 20:41:16 2020

@author: Kanaru Sato
"""

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

for i in range(n-1):
    if a[i] in d:
        d[a[i]] += 1
    else:
        d[a[i]] = 1

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

Submission status: Accepted

Solution code:
from collections import Counter
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)
    ans = []
    for i in range(1,N+1):
        if i in C:
            ans.append(C[i])
        else:
            ans.append(0)
    return ans
print(*solve(),sep='\n')

Submission status: Accepted

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

Submission status: Accepted

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

N = int(readline().strip())

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

ans = [0] * N

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

for a in ans:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
*A, = map(int, input().split())
cnt = Counter(A)
for i in range(1, N+1):
    print(cnt[i])

Submission status: Accepted

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

ans = [0] * N

for i in range(len(l)):
    ans[l[i] - 1] += 1

for i in ans:
    print(i)

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:
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    G = [[] for _ in range(N)]
    for i, a in enumerate(A):
        G[a-1].append(i+1)
    for g in G:
        print(len(g))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N - 2 + 1)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7
INF = 10 ** 12
import sys
sys.setrecursionlimit(1000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  itertools import permutations

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

if __name__ =='__main__':
    main()

Submission status: Accepted

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

count = [0]*N
for elem in A:
    count[elem-1] += 1
for c in count:
    print(c)

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:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    ans = [0]*N
    for a in A:
        ans[a-1]+=1
    print(*ans,sep="\n")
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N-1):
    josi[a[i]-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(n-1):
    ans[As[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 a in A:
    l[a-1] += 1

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

Submission status: Accepted

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

for si in subordinate:
    print(si)

Submission status: Accepted

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

for num in a:
    ans[num-1] += 1
    
for num in ans:
    print(num)

Submission status: Accepted

Solution code:
# ABC163c


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと
    from collections import Counter

    def dump(*args):
        sys.stderr.write(str(args))

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    count = [0]*N
    A = list(map(int,input().split()))
    for a in A:
        count[a-1] += 1
    for c in count:
        print(c)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

nums=[0]*(N+1)
for i in range(N-1):
    nums[A[i]]+=1
    
print(*nums[1:], sep='\n')

Submission status: Accepted

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

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

Submission status: Accepted

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

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))
    d = {}
    for i, a in enumerate(A):
        if a in d.keys():
            d[a] += 1
        else:
            d[a] = 1

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    n = int(input())
    a = list(map(int, input().split()))
    so = [0 for i in range(n)]
    for i in range(n - 1):
        j = a[i]
        so[j - 1] += 1
    for s in so:
        print(s)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

C=[[] for i in range(N+1)]

for i in range(2,N+1):
    C[A[i]].append(i)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
output_ = np.zeros(N)
for A_ in A:
    output_[A_ - 1] += 1
for o_ in output_:
    print(int(o_))

Submission status: Accepted

Solution code:
def main():
    import sys
    from collections import defaultdict
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    N = int(input())
    A = [int(x) for x in input().strip().split()]
    D = defaultdict(int)
    for a in A:
        D[a] += 1
    
    for n in range(1, N+1):
        print(D[n])

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [0] * N
    for a in A:
        B[a-1] += 1
    print("\n".join(map(str, B)))

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
lis = [0 for _ in range(n)]

a = list(map(int, input().split()))
for i in a:
    lis[i-1] += 1

for i in lis:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
res = [0] * N
for x in a: res[x - 1] += 1
for r in res: print(r)

Submission status: Accepted

Solution code:
from collections import defaultdict
d = defaultdict(int)

N = int(input())
A = list(map(int, input().split()))
for a in A:
    a -= 1
    d[a] += 1
for i in range(N):
    print(d[i])

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
cnt = Counter(a)

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

Submission status: Accepted

Solution code:
# python 3.8.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
from math import gcd
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def lcm(a,b):return (a*b) // gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')
def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
A = iln()

cnt = collections.Counter(A)

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

Submission status: Accepted

Solution code:
from collections import Counter

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

Submission status: Accepted

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

for v in dic.values():
  print(v)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

d = dict(zip(range(1, N+1), [0]*N))
for a in A:
    d[a] += 1

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

read = sys.stdin.read
readline = sys.stdin.readline

N, *A = map(int, read().split())
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())
boss = list(map(int, input().split()))
c = collections.Counter()
for b in boss:
    c[b] += 1
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 num in a:
    ans[num-1]+=1
for a in ans:
    print(a)

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 g in range(n):
    print(ans[g])

Submission status: Accepted

Solution code:
def main():
    N = int( input())
    A = list( map( int, input().split()))
    B = [0]*(N+1)
    for a in A:
        B[a] += 1
    print("\n".join( map( str, B[1:])))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

N = Int()
A = IntList()

from collections import defaultdict
D = defaultdict(int)

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

Submission status: Accepted

Solution code:
from collections import defaultdict
N=int(input())
a_list=list(map(int,input().split()))
par=defaultdict(int)
for a in a_list:
    par[a-1]+=1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    boss = [0] * N
    for i in range(len(A)):
        boss[A[i]-1]+=1
    for b in boss:
        print(b)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N - 2 + 1)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

for ans in cnt:
    print(ans)

Submission status: Accepted

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

l = [0] * (n)

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

for _l in l:
    print(_l)