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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

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

if __name__ == '__main__':
    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 j in b:
    print(j)

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

Submission status: Accepted

Solution code:
import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def solve():
    n = getN()
    li = [0 for i in range(n)]
    for nn in getList():
        # nn = getN()
        li[nn-1] += 1

    for nn in li:
        print(nn)

def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

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

s = []

for i in range(n):
    s.append(0)

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()))
 
# 各社員i(=1,...,N)についてそれぞれ、部下の人数を数えればよい
l = [0]*N
for i in A:
  l[i-1] += 1

for i in l:
  print(i)

Submission status: Accepted

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

# lは社員番号i(=1,...,N)の部下の人数を格納するリスト
l = [0]*N
for i in A:
  l[i-1] += 1

for i in l:
  print(i)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split())) # <- note that this has (N - 1) elements
#print(A)
A_0 = [x - 1 for x in A]
#print(A_0)
ans = [0] * N # <- represents number of immediate subordinates of each person

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(A)):
    sup[A[i]-1] += 1

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

Submission status: Accepted

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

Subordinate=[[] for i in range(N)]
for i in range(len(A)):
    A_i=A[i]
    Subordinate[A_i-1].append(A_i)

for i in Subordinate:
    print(len(i))

Submission status: Accepted

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

Submission status: Accepted

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

l = [0]*N

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

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

Submission status: Accepted

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

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

for i in k:
  print(i)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    lst = [0 for _ in range(2 * 10 ** 5 + 1)]

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    dic = dict()

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

    dic_keys = dic.keys()
    for i in range(1, n + 1):
        if i in dic_keys:
            print(dic[i])
        else:
            print(0)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
p = list(map(int, input().split()))
sya = [0]*N
t = 0



for i in range(N-1):
  t = p[i-1]
  sya[t-1] +=1



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

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a += list(range(1,n+1))
a = Counter(a).most_common()
a.sort()
for i,j in a:
    print(j-1)

Submission status: Accepted

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

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

for t in T:
    print(t)

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

for i in anslst:
    print(i)

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(A)

ans = []
for i in range(N):
    ans.append(c[i + 1])

[print(i) for i in ans]

Submission status: Accepted

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

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

Submission status: Accepted

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

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

[print(i) for i in ans]

Submission status: Accepted

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

Submission status: Accepted

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

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

[print(i) for i in arr]

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    Subs = [0 for _ in range(N)]
    for i, a in enumerate(A):
        Subs[a-1] += 1
    [print(n) for n in Subs]

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
import sys
input = sys.stdin.readline
lis = {}
A = list(map(int, input().split()))
for i in range(N-1):
  x = A[i]
  if x in lis:
    lis[x] += 1
  else:
    lis[x] = 1
for i in range(1, N+1):
  if lis.get(i) == None:
    print(0)
  else:
    print(lis.get(i))

Submission status: Accepted

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


A.sort()
A.append(N + 1)
ans = [0] * (N+1)
count = [0, 0]

for i in range(N):
    if count[0] == A[i]:
        count[1] += 1
    else:
        ans[count[0]] = count[1]
        count[0] = A[i]
        count[1] = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import math
#import collections
#n,m = map(int, input().split( ))
n = int(input())
A = list(map(int, input().split( )))
arr = [0]*n
for a in A:
  arr[a-1] += 1
for a in arr:
  print(a)

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
a = inl()
ans = [0] * n
for i in a:
    ans[i-1] += 1
out(ans)

Submission status: Accepted

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

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

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

d = {}

for a in A :
    d.setdefault(a,0)
    d[a] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(a_array)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for j in a:
  print(j)

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

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())
rel_list = map(int, input().split())

member_list = [0]*N
for rel in rel_list:
    member_list[rel-1] += 1

[print(i) for i in member_list]

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

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

Submission status: Accepted

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

for j in b:
    print(j)

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()))
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())
an = [0 for _ in range(n)]

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

for a in an:  
  print(a)

Submission status: Accepted

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

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

for i in lst[1:]:
  print(i)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

# 1...Nまでを回して、同じ番号をA2...ANまで探索するとO(N^2)となって間に合わない
#そのため、A2...ANを探索して社員番号をカウントしてく方針とする
#その方針だとO(N)となり、間に合う

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()))
li=[0]*n

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
b=[0]*n
for i in a:
  b[i-1]+=1
print(*b, sep="\n")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num_employees = int(input())

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

counter = [0] * num_employees

for boss in bosses:
    counter[boss - 1] += 1

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

Submission status: Accepted

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

for i in N_List.values():
    print(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:
nn = int(input())
aa = list(map(int,input().split()))

joushi = [0]*nn

for i in range(len(aa)):
    joushi[aa[i]-1] += 1

for j in range(len(joushi)):
    print(joushi[j])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
Ans = [0] * (N+1)
for a in A:
    Ans[a] += 1
print("\n".join(map(str, Ans[1:])))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
N = int(input())
A = [int(x) for x in input().split()]
A=sorted(A)
index = 0
for i in range(1, N+1):
    now = bisect.bisect_right(A, i)
    print(now - index)
    index = now

Submission status: Accepted

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

Submission status: Accepted

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

for i in a:
  s[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()))
ans = {i:0 for i in range(n)}
for i in a:
  ans[i-1] += 1

for i in ans.values():
  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(1,len(A)+2):
    print(a[i])

Submission status: Accepted

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

subordinate = {}
for b in boss:
    subordinate[b] = subordinate.get(b, 0) + 1

for i in range(1, n+1):
    print(subordinate.get(i, 0))

Submission status: Accepted

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

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

print("\n".join([str(s) for s in S]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    counter = {}
    for num in A:
        counter[num] = counter.get(num, 0) + 1
    for i in range(1, N+1):
        print(counter.get(i, 0))

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

for i in employee:
    num[i-1] += 1

for j in num:
    print(j)

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())
s = map(int, input().split(" "))
data = Counter(s)
for i in range(1, n+1):
    print(data.get(i, 0))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = [0] * N #部下の人数

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

for b in B:
    print(b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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 i in range(N):
    print(B[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:
N=int(input())
A=list(map(int, input().split()))

B=[0]*N

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def main():
    N = int(input())
    A = [int(x) for x in input().split()]

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections

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

ans = collections.Counter(A)

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

Submission status: Accepted

Solution code:
import collections

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

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

Submission status: Accepted

Solution code:
n = int(input())
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:
import collections
N=int(input())
A=[x for x in input().split()]
c = collections.Counter(A)
for i in range(N):
	print(c["{}".format(str(i+1))])

Submission status: Accepted

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

print('\n'.join([str(i) for i in subords]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
A = LI()
ans_list = [0] * N
for a in A:
    ans_list[a - 1] += 1
for i in range(N):
    print(ans_list[i])

Submission status: Accepted

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

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

[print(i) for i in b[1:]]

Submission status: Accepted

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

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

for j in range(n):
    print(ans[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 b in B:
	print(b)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import pi
def main():
    n, *a = map(int, read().split())
    cnt = [0] * n
    for ae in a:
        cnt[ae-1] += 1
    print(*cnt, sep='\n')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
d = {}
for i in range(1, N+1):
    d[i] = 0
for i in range(N-1):
    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()))
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()))
cnt = [0]*N

for a in A:
    cnt[a-1] += 1
print('\n'.join(map(str,cnt)))
#count()ではTLE

Submission status: Accepted

Solution code:
import collections
N = int(input())

Boss = [int(x) for x in input().split()]
kind_of_Boss = collections.Counter(Boss)

for i in range(1,N):
    print(kind_of_Boss[i])
    
print(0)

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 i in range(n):
    print(ANS[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 i in buka:
    print(i)

Submission status: Accepted

Solution code:

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

ans = [0] * (N + 1)
for v in X:
    ans[v] += 1

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

Submission status: Accepted

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

buka = [0] * (n+1)
for i in a:
    buka[i] += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

import bisect

for i in range(1,N+1):
    print(bisect.bisect_right(A,i)-bisect.bisect_left(A,i))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=l=list(map(int, 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 = list(map(int, input().split()))
D = {c:0 for c in range(N)}
for a in A:
  D[a-1] += 1
for d in D.values():
  print(d)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

def main(n,a):
    buka=[0]*(n+1)
    for i in range(n-1):
        buka[a[i]]+=1
    return buka[1:n+1]

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    for i in range(n):
        print(ans[i])

Submission status: Accepted

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

for z in range(n):
    print(R[z])

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n-1):
  b[a[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()))
cnt_a = [0] * (n + 1)
for ai in a:
    cnt_a[ai] += 1
print(*cnt_a[1:], sep='\n')

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = [0]*n

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

print("\n".join(map(str,ans)))

Submission status: Accepted

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

ans = [0]*n

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

for i in ans:
    print(i)

Submission status: Accepted

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

result = [0] * N

for n in A:
    result[n - 1] += 1

for r in result:
    print(r)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

A.sort()
ans = [0] * N
m = -1

for i in range(N-1):
    if i == N-2:
        ans[A[i]-1] = i - m
    elif A[i] != A[i+1]:
        ans[A[i]-1] = i - m
        m = i
for i in range(N):
    print(ans[i])

Submission status: Accepted

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

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

[print(i) for i in list]

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    N = int(input())
    buka_num_arr = [0] * N
    joshi_idx_arr = list(map(int,input().split()))
    for joshi_idx in joshi_idx_arr:
        buka_num_arr[joshi_idx-1] += 1
    for i in range(N):
        print(buka_num_arr[i])

Submission status: Accepted

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

for i in l[1:]:
    print(i)