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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections


member_cnt = int(input())
bosses = input().split(' ')
boss_dict = collections.Counter(bosses)

for i in range(1, member_cnt + 1):
  print(boss_dict.get(str(i), 0))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

dic = {str(num):0 for num in range(1, n + 1)}

for a in As:
    dic[str(a)] += 1

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

Submission status: Accepted

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


def solve(N: int, A: "List[int]"):
    d = [int()]*N

    for x in A:
        d[x-1]+=1
    [print(d_) for d_ in d]

    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:
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
l = [str(0) for i in range(n)]
key = list(c.keys())
for i in range(len(list(c.keys()))):
    l[key[i]-1] = str(c[key[i]])
print('\n'.join(l))

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = 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('\n'.join(map(str,ans)))
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
A_np = np.zeros(N)
A=list(map(int, input().split()))
for Ai in A:
  A_np[Ai-1] = A_np[Ai-1] + 1
for i in range(N):
  print('{:.0f}'.format(A_np[i]))

Submission status: Accepted

Solution code:
N = int(input())
M = [int(n) for n in input().split()]

boss = {}
boss[0] = 0
for i, v in enumerate(M):
  boss[i+1] = 0
  boss[v-1] += 1
#print(boss)
for i in range(N):
  print(boss[i])

Submission status: Accepted

Solution code:
N=int(input())
As=[int(e) for e in input().split(' ')]

l=[0]*N

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

for e in l:
    print(e)

Submission status: Accepted

Solution code:
a = int(input())
lists = list(map(int, input().split())) #１行の入力をi[0],i[1]というように空白で分けてを取得し、iに値を入れる

num = [0]*a

def mi(x):

    
    return int(x-1)

y = list(map(mi,lists))

for i in range(a-1):
    num[y[i]] += 1
for i in range(a):
    print(num[i])

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

if __name__ == "__main__":
    N = int(input())
    A = dict(collections.Counter(LI()))
    for i in range(1, N+1):
        count = A.get(i)
        print(count if count is not None else 0)

Submission status: Accepted

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

dic = {}
for i in range(n):
    dic[i] = 0
for i in range(len(a)):
    a[i] -= 1
    dic[a[i]] += 1
dic = sorted(dic.items())

for item in dic:
    first, second = item
    print(second)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  collection = Counter(A)
  for i in range(1, N + 1):
    print(collection[i])
  # results = [str(A.count(i))+'\n' for i in range(1, N+1)]
  # print('\n'.join(results))

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
n=int(input())
a_list=[int(i) for i in input().split(' ')]

import collections

c = collections.Counter(a_list)
[print(c[i+1]) for i in range(n)]

Submission status: Accepted

Solution code:
from collections import Counter

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

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
num = int(readline().rstrip())
arr = list(map(int,readline().rstrip().split()))
dic = {}
for i in arr:
    if i in dic:
        dic[i] +=1
    else:
        dic[i]=1
print(dic[1])
for j in range(2,num+1):
    if j in dic:
        print(dic[j])
    else:
        print('0')

Submission status: Accepted

Solution code:
n = int(input())

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

x = len(c)

lst = [0]*n

for i in range(x):
    lst[ c[i] - 1 ] += 1
    
for i in range(n):
    print(lst[i])

Submission status: Accepted

Solution code:
from collections import Counter
n=int(input())
a=Counter(list(map(int,input().split())))
ans=[0]*n
for i,j in a.items():
	ans[i-1]=j
for k in ans:
	print(k)

Submission status: Accepted

Solution code:
import collections

n= int(input())
li=list(map(int,input().split()))
c=collections.Counter(li)

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int, input().split()))
ANS = [0 for i in range(N)]

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

for a in ANS:
    print(a)

Submission status: Accepted

Solution code:
import collections

N=int(input())

A=input().split()

c=collections.Counter(A)
result=[]

for i in range(1,N+1):
    result.append(c[str(i)])

for r in result:
    print(r)

Submission status: Accepted

Solution code:
from sys import stdin
import numpy as np
N=list(map(int,(stdin.readline().strip().split())))[0]
A=list(map(int,(stdin.readline().strip().split())))
num_list=[0]*N
moji=A[0]
i=0
length=len(A)-1
for i in A:
    num_list[i-1]+=1
for num in num_list:
    print(num)

Submission status: Accepted

Solution code:
employeeCount = int(input())
directBosses = list(map(int, input().split()))
directJuniorCounts = [0] * employeeCount

for boss in directBosses:
    directJuniorCounts[boss - 1] += 1

for jc in directJuniorCounts:
    print(jc)

Submission status: Accepted

Solution code:
N = int(input())
a_list = [i for i in input().split()]
result = [0 for i in range(1, N+1)]

for i in a_list:
    result[int(i)-1] += 1

for a in result:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

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

c = Counter(arr)

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 a:
    ans[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()))
count = [0] * n
for ai in a:
    count[ai-1] += 1
list(map(print, count))

Submission status: Accepted

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

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

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

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


counter = dict()
for i in A:
    if i not in counter.keys():
        counter[i] = 1
    else:
        counter[i]+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def main():
    N = int(input())
    l = [int(_) for _ in input().split()]
    count_list = [0] * N
    for i in l:
        index = i - 1
        count_list[index] += 1

    for out in count_list:
        print(out)
main()

Submission status: Accepted

Solution code:
import collections
from collections import Counter
n=int(input())
d=collections.deque()
l=list(map(int,input().split()))
d.extend(l)
d.appendleft(0)
c=dict(Counter(d))
s=set(d)
for x in range(1,len(d)+1):
    if x in s:
        print(c[x])
    else:
        print(0)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
cnt = []
[cnt.append(0) for _ in range(len(A))]

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

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

print("0")

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

Submission status: Accepted

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



# if N >= sum(A):
#     print(N-sum(A))
# else:
#     print(-1)
count= [0] * N

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

# def count_defaultdict(it):
#     counter = collections.defaultdict(int)
#     for x in it:
#         counter[x] += 1
#     return dict(counter)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = 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

    for i in ans:
        print(i)
    

if __name__ == "__main__":
    main()

Submission status: Accepted

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

a.sort()

lis = [0] * n
m = 1

for i in range(0, n-1):
    while a[i] > m:
        m += 1
    lis[m-1] += 1
    
for i in range(n):
    print(lis[i])

Submission status: Accepted

Solution code:
N = int(input())
l = list(map(int, input().split()))
l.append('END')
ans = l.copy()
for i in range(len(l)):
    ans[i] = 0
try:
    for i in range(len(l)):
        ans[l[i] - 1] += 1
except TypeError:
    pass
for i in ans:
    print(i)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

List1 = [int(a) for a in input().split(" ")]
List2 = [0]*N

for x in List1:
  List2[x-1] = List2[x-1] + 1
  
for y in List2:
  print(y)

Submission status: Accepted

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

la.append(N+1)

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

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

Submission status: Accepted

Solution code:
n, = tuple(int(s) for s in input().split())
arr = list(int(s) for s in input().split())

import collections
cc = collections.defaultdict(set)
for i, x in enumerate(arr):
    cc[x].add(i)

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

Submission status: Accepted

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

mydict = {}
for i in range(N):
    mydict[i] = 0


for i in range(len(a)):
    if M-a[i] <= N:
        mydict[a[i]-1] += 1 
        N -= 1
        M -= a[i]

for i in range(W):
    print(mydict[i])

Submission status: Accepted

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

# for i in range(n):
#     print(boss_list.count(i + 1))

import collections
c = collections.Counter(boss_list)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 22:00 ~

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

shain = [0] * n

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

print(*shain)

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] += int(A[i]/A[i])
    
[print(B[i]) for i in range(N)]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
a  = list(input().split())
fact_count = dict(Counter(a))
for i in range(1, N+1):
    try:
        print(fact_count[str(i)])
    except:
        print(0)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# coding: utf-8

# def debug(arg):
#     if __debug__:
#         pass
#     else:
#         import sys
#         print(arg, file=sys.stderr)

def main():
    N, *A = map(int, open(0).read().split())

    b = dict.fromkeys(range(1, N + 1), 0)

    for i, a in enumerate(A, 1):
        b[a] += 1
    
    for bb in b.values():
        print(bb)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import collections

n = int(input())
mentors = input().split(" ")

a = collections.Counter(mentors)

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

Submission status: Accepted

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

B=sorted(A)

def histogram_sorted(data):
    table = []
    prev = data[0] 
    c = 1
    for i in range(1,len(data)):
        if prev == data[i]:
            c=c+1
        else:
            table.append([prev,c])
            prev = data[i]
            c = 1
    table.append([prev,c])
    return table

X = histogram_sorted(B)

X.append([0,0])

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

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

bossNums=[]

for i in range(Num):
  bossNums.append(0)


for i in range(Num-1):
  bossNums[bossNumsList[i]-1] += 1

for i in range(Num):
  print(bossNums[i])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

n = int(n)

sort_a = sorted(a)


buka = []
boss_num = 1
buka_count = 0

i = 0
while boss_num < n:
    if i > n-2 and boss_num < n:
        buka.append(buka_count)
        buka_count = 0
        boss_num = boss_num + 1
    elif boss_num == sort_a[i]:
        buka_count = buka_count + 1
        i = i + 1
    elif boss_num != sort_a[i] and i <= n-2:
        buka.append(buka_count)
        boss_num = boss_num + 1
        buka_count = 0

buka.append(0)

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

Submission status: Accepted

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

emp_num = [0] * N

for j in range(N-1):
    emp_num[A[j]-1] += 1

for k in range(N):
    print(emp_num[k])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
A.sort(key=int)
l=0
for i in range(N):
    c=0
    while l < len(A) and A[l] == i+1:
        l+=1
        c+=1
    print(c)

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 = input()
l = input().split()
c = collections.Counter(l)

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

Submission status: Accepted

Solution code:
import collections

n = input()
n = int(n)
alist = input().split(" ")
intalist = [int(s) for s in alist]
setalist = list(set(intalist))
# print(setalist)
c = collections.Counter(intalist)
# print(c)
result = [0] * n
if n == 1:
    print(0)
else:
    for i in range(0,n):
        try:
            result[setalist[i] - 1] = c[setalist[i]]
            # print(c[setalist[i]])
        except IndexError:
            pass
for i in range(0,n):
    print(result[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def q3():
    from collections import deque
    N = int(input())
    A = deque([int(i) for i in input().split()])
    ans = [0]*N
    for a in A:
        ans[a-1] += 1
    for i in ans:
        print(i)


if __name__ == '__main__':
    q3()

Submission status: Accepted

Solution code:
import collections
N = int(input())
A = input().split()
count_dict = collections.Counter(A)
for i in range(N):
    count = count_dict[str(i+1)]
    print(count)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
number = []
for i in range(N):
  number.append(0)

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

del number[0]
number.append(0)
for Answer in number:
  print(Answer)

Submission status: Accepted

Solution code:

N = int(input())
sub = [0]*(N+1)


for bossi in map(int, input().split()):
    sub[bossi] = sub[bossi]+1

for i in range(1, N+1):
    print(sub[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

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

Submission status: Accepted

Solution code:
worker_num=int(input())
num_director=input().split()
count_director=[]
for j in range(len(num_director)+1):
    count_director.append(int(0))

for i in num_director:
    count_director[int(i)-1] +=1

for out in count_director:
    print(out)

Submission status: Accepted

Solution code:
import collections
N = int(input())
A = [0]
A.extend(list(map(int, input().split())))
c = collections.Counter(A)
buka_num = []

for i in range(1,N):
    buka_num.append(c[i])
    
buka_num.append(0)
for ele in buka_num:
    print(ele)

Submission status: Accepted

Solution code:
numOfWorker = int(input())

followId = list(map(int, input().split(" ")))

followCounter = [0] * numOfWorker

for id in followId:
    followCounter[id - 1] += 1

for value in followCounter:
    print(value)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A = list(map(int,input().split()))
import collections
c = collections.Counter(A)
for i in range(N):
  i+=1
  print(c[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()))
A.sort()
indexA=0
A.append(N+10)
for x in range(N):
  check=1
  countA=0
  while check==1:
    if A[indexA]!=x+1:
      check=0
      countA-=1
      indexA-=1
    indexA+=1
    countA+=1
  print(countA)

Submission status: Accepted

Solution code:
n = input()
line = input()
n = int(n)
a_list = line.split(" ")
a_list = [int(a) for a in a_list]

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

for a in a_list:
    ans_list[a-1] = ans_list[a-1] + 1

for ans in ans_list:
    print(ans)

Submission status: Accepted

Solution code:

def CountFrequency(my_list,n): 
  
    # Creating an empty dictionary  
    freq = {}
    for  i in range(1,n+1):
    	freq[i]=0

    for item in my_list: 
        if (item in freq): 
            freq[item] += 1
        else: 
            freq[item] = 1
  
    for key, value in freq.items(): 
        print (value)
  
# Driver function 
if __name__ == "__main__":  
    n=int(input())
    l=list(map(int,input().split())) 
  
    CountFrequency(l,n)

Submission status: Accepted

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

for i in range (len(k)):
    x[(k[(i)]-1)] += 1

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

Submission status: Accepted

Solution code:
import collections
N=int(input())
A=[int(x) for x in input().split()]
A_1=collections.Counter(A)
i=0
if 2<=N<=2*10**5:
    for i in range(0,N-1):
        if 0<=i<=N-2:
            if 1<=A[i]<i+2:
                j=i+1
                print(A_1[j])
                i+=1
        if i==N-1:
            print(0)

Submission status: Accepted

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

tb = [0] * n

for x in arr:
    tb[x - 1] += 1
    
for t in tb:
    print(t)

Submission status: Accepted

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

for a in a_list:
    result_list[a-1] += 1

result_list_str = [str(i) for i in result_list]
print('\n'.join(result_list_str))

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
subs=[0 for i in range(N)]
for i in range(len(A)):
	subs[A[i]-1]+=1
#print(subs)
for i in subs:
	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
del ans[0]
ans.append(A.count(N))
for i in range(N):
  print(ans[i])

Submission status: Accepted

Solution code:
import bisect

man_count = int(input())

infos = [int(i) for i in input().split()]
infos.sort()

next_num = 0
end = 0
for i in range(len(infos)+1):
    if i != next_num:
        print(0)
        continue

    # 速度を上げるために添え字を吹き飛ばそう。
    start = bisect.bisect_right(infos, i+1, end)  # iが始まる添え字を得る。
    print(start - end)
    end = start

    # 添え字が最後の場合 or 最後でない で切り分け必要。
    if start == len(infos):
      next_num = infos[start-1] -1
    else:
      next_num = infos[start] -1

#for i in ans:
#    print(i)

Submission status: Accepted

Solution code:
size = int(input())
li = list(map(int,input().split()))
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    print(i)

Submission status: Accepted

Solution code:
import collections

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

Submission status: Accepted

Solution code:
people = int(input()) - 1
boss = input().split(' ')
boss = list(map(int,boss))
dict_boss = {}
for i in range(people):
	if boss[i]-1 not in dict_boss:
		dict_boss[boss[i]-1] = 1
	else:
		dict_boss[boss[i]-1] += 1
boss = [0] * (people + 1)
for key in dict_boss:
	boss[key] = dict_boss[key]
for i in boss:
	print(i)

Submission status: Accepted

Solution code:
tmp = input().split(" ")
N = int(tmp[0])
tmp = input().split(" ")
A = [int(i) for i in tmp]
nofb = [0]*N
for i in range(N,1,-1):
  #print("社員番号",i,"が送る尊敬の眼差し",A[i-2])
  boss = A[i-2]
  nofb[boss-1] += 1
for i in range(N):
  print(nofb[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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

def format_input(filename = None):
	global n
	global a
	if filename == None:
		n = int(input())
		a = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(2, 2 * 10**5)
		a = [rng(1, i) for i in range(1, n)]
		print(n)
		print(' '.join(list(map(str, a))))

def get_answer():
	count = [0] * (n+1)
	for i in a:
		count[i] += 1
	for i in range(1, n+1):
		print(count[i])

if __name__ == '__main__':
	format_input()

	get_answer()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter 

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

Submission status: Accepted

Solution code:
import collections

N = int(input())
A = input().split(sep=' ')
A_list = []
for i in A:
    A_list.append(int(i))

c = collections.Counter(A_list)

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

Submission status: Accepted

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

for i in range(len(syain)):
  dic[syain[i]] += 1

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

Submission status: Accepted

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

from collections import Counter

cnt = Counter(A)

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    A.append(i)
ans = collections.Counter(A)
tmp = sorted(ans.items())
for i in range(N):
    print(tmp[i][1]-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    i = list(map(int, input().split()))
    l = [0] * n
    for k in i:
        l[k-1] += 1
    for j in l:
        print('{}'.format(j))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
import numpy as np

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

answer = np.zeros(n ,dtype=int)
for number in l:
  answer[number-1] += 1


for j in range(n):
  c = round(answer[j])
  print(c)

Submission status: Accepted

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