Problem:


Score : 300 points

Problem Statement

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

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

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

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

Constraints

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

1 \leq A_i < i

Input

Input is given from Standard Input in the following format:

N
A_2 ... A_N

Output

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

Sample Input 1

5
1 1 2 2

Sample Output 1

2
2
0
0
0

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

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

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

Sample Input 2

10
1 1 1 1 1 1 1 1 1

Sample Output 2

9
0
0
0
0
0
0
0
0
0

Sample Input 3

7
1 2 3 4 5 6

Sample Output 3

1
1
1
1
1
1
0



Sample input:
5
1 1 2 2


Sample output:
2
2
0
0
0

Submission status: Accepted

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

Submission status: Accepted

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

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

for v in l:
    print(v)

Submission status: Accepted

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

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

a.sort()
a = collections.deque(a)
counter = 0
for i in range(1, n+1):
    while len(a) != 0:
        if i != a[0]: 
            break
        counter += 1
        a.popleft()    
    print(counter)
    counter = 0

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
A = list(map(int, input().split()))
B = [0 for _ in range(N)]
for index in A:
    B[index - 1] += 1
for ans in B:
    print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
counter = Counter(tuple(map(int, input().split(' '))))

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

Submission status: Accepted

Solution code:
n = int(input())
ar = [int(x) for x in input().split()]
count = [0]*n

for v in ar:
    count[v-1]+=1

for v in count:
    print(v)

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 = [int(x) for x in 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 sys
N = int(input())
A = list(map(int, sys.stdin.readline().rstrip().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 = [int(x) for x in input().split()]
c = collections.Counter(a)

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

Submission status: Accepted

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

for i in m:
    syain[i-1] += 1

print('\n'.join(list(map(str,syain))))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(n) for n in input().split(' ')]
boss = {}
for i in range(N-1):
  try:
    boss[A[i]] += 1
  except:
    boss[A[i]] = 1
    
for i in range(1, N+1):
  try:
    print(boss[i])
  except:
    print(0)

Submission status: Accepted

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

D={}
for i in range(N-1):
    if (A[i] in D.keys())==True:
        D[A[i]]+=1
    elif (A[i] in D.keys())==False:
        D[A[i]]=1
for i in range(1,N+1):
    try:
        print(D[i])
    except:
        print(0)

Submission status: Accepted

Solution code:
#import bisect,collections,copy,heapq,itertools,math,numpy,string
#from operator import itemgetter
import sys
def I(): return int(sys.stdin.readline().rstrip())
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 = [0] * N

for v in A:
  ans[v-1]+=1
for i in ans:
  print(i)

Submission status: Accepted

Solution code:
n=int(input())
ls=list(map(int,input().split()))
counter=[0 for _ in range(n-1)]
for i in ls:
  counter[i-1]+=1
for i in counter:
  print("{}".format(i))
print("0")

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int, input().split())
dic = {i: 0 for i in range(1, N+1)}
for x in A:
    if x in dic:
        dic[x] += 1
for k, v in dic.items():
    print(v)

Submission status: Accepted

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

sig = [0] * N

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

#print(sig)
for i in sig:
  print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

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

for j in ans:
    print(j)

Submission status: Accepted

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

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:
import sys
from collections import deque
import copy
def main():
    N = int(input())
    A = [(int(i) - 1) for i in input().split()]
    ans = [0 for i in range(N)]
    for i in range(len(A)):
        ans[A[i]] += 1
    for i in range(N):
        print(ans[i])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
t = list(input().split(" "))
s={}
for i in set(t):
    s[i] = 0
    
for i in t:
    s[i] += 1

# print(s)
# print(s["1"])
for i in range(n):
    if str(i+1) in s:
        # print(i)
        print(s[str(i+1)])
    else:
        print(0)

Submission status: Accepted

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

ans = [0 for _ in range(N)]

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

for j in ans:
    print(j)

Submission status: Accepted

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

ans = [0]*N

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

for j in ans:
    print(j)

Submission status: Accepted

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

for i in a:
  lis[i-1] += 1
  
print(*lis,sep = '\n')

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
line=input()
koko=line.split()
koko=map(int,koko)
koko=list(koko)
ans=dict.fromkeys(list(range(n+1)),0)
for val in koko:
     ans[val]=ans.get(val,0)+1
po=ans.pop(0)
for (k,v) in ans.items():
     print(v)

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

        l = [0]*N

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

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()

Submission status: Accepted

Solution code:
n=int(input())

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

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

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

Submission status: Accepted

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

count = Counter(a)
for i in range(n):
  if i+1 in count:
    print(count[i+1])
  else:
    print(0)

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

Submission status: Accepted

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

l = [0] * N

for i in range(len(s)):
  l[s[i] - 1] = l[s[i] - 1] + 1
  
for i in range(N):
  print(l[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    n = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    a = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    c = Counter(a)
    for i in range(n):
        print(c[i+1])

main()

Submission status: Accepted

Solution code:
N = int(input().strip())
data = [0 for _ in range(N)]
for i in input().strip().split(' '):
    data[int(i)-1] += 1

for d in data:
    print(d)

Submission status: Accepted

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

ans = [0] * (N + 1)

for i in A:
    ans[i] += 1
    
for i in ans[1:]:
    print(i)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))

    g = [0] * n
    for ai in a:
        g[ai - 1] += 1
    print(*g, sep='\n')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(input().split())
#print(a)

employ = {}

for i in range(len(a)):
    if a[i] in employ:
        employ[a[i]] = employ[a[i]] + 1
    else:
        employ[a[i]] = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

for i in check:
    print(i)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = [0 for _ in range(N)]

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

for n in ans:
    print(n)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
n = [0] * N
#A_2 A_3 ... A_N とA_1をのぞいて続くのでN-1となる
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 = [int(x) for x in input().split()]
L = [0]*N
for i in range(N-1):
  L[A[i]-1]+=1
[print(i) for i in L]

Submission status: Accepted

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

dic = {}
for i in range(1,n+1):
    dic[i] = 0

for a in an:
    dic[a] += 1

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

Submission status: Accepted

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

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

for i in tm:
    print(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 v in l:
    print(v)

Submission status: Accepted

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

count = [0]*N

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

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

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

for i in res:
    print(i)

Submission status: Accepted

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

    anss = [0]*n
    for A in As:
        anss[A-1] += 1
    for ans in anss:
        print(ans)


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

for j in ans:
    print(j)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = map(int, input().split())
l = [0] * N

for x in L:
    l[x-1] += 1

for i in l:
    print(i,end="\n")

Submission status: Accepted

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

Submission status: Accepted

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

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

for a in ans[1:]:
    print(a)

Submission status: Accepted

Solution code:
def solve(string):
    n, *a = map(int, string.split())
    ans = [0] * n
    for _a in a:
        ans[_a - 1] += 1
    return "\n".join(map(str, ans))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

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

from collections import defaultdict
d = defaultdict(int)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
ans = [0] * N
for i in A:
    ans[i-1] += 1
for result in ans:
    print(result, "\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
for c in cnt:
    print(c)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
T = {}
for i in A:
    if i not in T:
        T[i] = 0
    T[i] = T[i] + 1
for i in range(1, N+1):
    print(T.get(i, 0))

Submission status: Accepted

Solution code:
from collections import Counter
n = list(range(int(input())))
l = input().split()
lt = [int(i) for i in l]
f = Counter(l)
for i in n:
    print(f[str(i+1)])

Submission status: Accepted

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

bs = [0] * N
for a in As:
  bs[a-1] += 1

for b in bs:
  print(b)

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())
bosses = map(int, input().split())
subordinates = [0] * n
for boss in bosses:
    subordinates[boss-1] += 1
print("\n".join(map(str, subordinates)))

Submission status: Accepted

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

subordinates = [0] * (N + 1)
for boss in bosses:
  subordinates[boss] += 1

print("\n".join(map(str, subordinates[1:])))

Submission status: Accepted

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

subordinates = [0] * (N + 1)
for boss in bosses:
  subordinates[boss] += 1
  
for count in subordinates[1:]:
  print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


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


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

for k in ans:
    print(k)

Submission status: Accepted

Solution code:
import collections as col

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

List = col.Counter(List)
Count_List = [0]*n
for i in List:
    Count_List[i-1] = List[i]

for i in Count_List:
    print(i)

Submission status: Accepted

Solution code:
import collections as col

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

List = col.Counter(List)
Count_List = [0]*n
for i in List:
    Count_List[i-1] = List[i]

for i in range(0,len(Count_List)):
    print(Count_List[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import time
from collections import defaultdict,deque
from sys import stdin,stdout
from bisect import bisect_left,bisect_right
n=int(input())
count=[0]*n
a=list(map(int,stdin.readline().split()))
for i in a:
    count[i-1]+=1
for i in count:
    print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
cnt = [0 for i in range(N+1)]
for a in A:
    cnt[a] += 1
for c in cnt[1:]:
    print(c)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in s:
  print(i)

Submission status: Accepted

Solution code:
n = int(input())

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

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

for ai in ans:
  print(ai)

Submission status: Accepted

Solution code:
n = int(input())

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

men = {}

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

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

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

Submission status: Accepted

Solution code:
from sys import stdin, stdout
from collections import deque, defaultdict
import math as m

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n = int(rl())
	cnt = defaultdict(lambda: 0)
	for boss in rli():
		cnt[boss] += 1
	for i in range(1, n + 1):
		print(cnt[i])
	stdout.close()

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
from sys import stdin, stdout
from collections import deque, defaultdict
import math as m

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n = int(rl())
	A = list(rli())
	cnt = defaultdict(lambda: 0)
	for i, boss in enumerate(A):
		cnt[boss] += 1
	for i in range(1, n + 1):
		print(cnt[i])
	stdout.close()

if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
N = int(input())
A = [0]*2 + [int(n) for n in stdin.readline().split()]
ans = [0]+[0]*N
for i in range(2, 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()))
dict = {}
for i in range(n - 1):
    if a[i] in dict:
        dict[a[i]] += 1
    else:
        dict[a[i]] = 1
for i in range(1, n + 1):
    if i in dict:
        print(dict[i])
    else:
        print(0)

Submission status: Accepted

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

# from fractions import gcd
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

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

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

Submission status: Accepted

Solution code:
def actual(n, a_list):
    points = [0 for _ in range(n)]

    for supervisor_idx in a_list:
        points[supervisor_idx - 1] += 1

    for p in points:
        print(p)

    return points

n = int(input())
a_list = map(int, input().split())

actual(n, a_list)

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

Submission status: Accepted

Solution code:
import collections
 
n = int(input())
dic = collections.Counter(input().split())
for i in range(n):
  print(dic[str(i+1)])

Submission status: Accepted

Solution code:
import collections

n = int(input())
dic = collections.Counter(input().split())
for i in range(n):
  print(dic[str(i+1)])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = '\n'.join(map(str,nums[1:]))
print(ans)

Submission status: Accepted

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

buka = [0] * N

for ai in A:
    buka[ai-1] += 1

for bi in buka:
    print(bi)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
nums = {}
for i in range(n):
    nums[i] = 0
for j in range(n-1):
    nums[a[j]-1] += 1
for key, value in nums.items():
    print(value)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
buka = np.zeros(N, dtype=int)  # 社員iの部下の数buka[i]
for i in range(len(A)):
    buka[A[i]-1] += 1
for i in range(N):
    print(buka[i])

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
n = int(input())
a = list(map(int, input().split()))

count = [0] * n

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 社員数
n = int(input())

# 社員番号
a = 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 ans:
    print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)
from collections import defaultdict

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
import collections

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

data = [0] * N

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


for i in range(N):
    print("{}".format(data[i]))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

ans = [0] * N

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

for j in ans:
    print(j)

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
n = int(input())
a = list(map(int, input().split()))

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

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

Submission status: Accepted

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

b=[0]*N
for c in A:
    b[c-1]+=1

for i in b:
    print(i)

Submission status: Accepted

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

b = [0]*n

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

for x in b:
    print(x)

Submission status: Accepted

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

result = [0]*N

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

for i in result:
    print(i)

Submission status: Accepted

Solution code:
import collections

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

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter
n = int(input())
a_ls = [int(i) - 1 for i in sys.stdin.readline().split()]
ct = Counter(a_ls)
for i in range(n):
    print(ct[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(len(ans)):
    print(ans[i])

Submission status: Accepted

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

n_senior = [0] * (N-1)

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

n_senior = n_senior + [0]
print("\n".join(map(str,n_senior)))

Submission status: Accepted

Solution code:
def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    ans=[0]*n
    A=list(map(int,input().split()))
    for i in range(n-1):
        a=A[i]
        ans[a-1]+=1
    for i in range(n):
        print(ans[i])
if __name__ == '__main__':
    main()