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: Runtime Error

Solution code:
import collections

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

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

Submission status: Runtime Error

Solution code:
input_line = int(input())
ans = [0] * input_line

inputs = input().split(' ')
inputs = list(map(int, inputs))
for i in range(1, len(inputs)):
  if i in inputs:
    ans[i] += 1

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

Submission status: Runtime Error

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

buka_num = [0]

for i in range(1, N+1):
  tmp_A = A[i:]
	buka_num.append(tmp_A.count(i))

print(buka_num, sep='¥n')

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
A = [0 for i in range(n)]
for aa in a:
    A[a]+=1
for aa in A:
    print(aa)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(int,input().split()))
 
for i in range(n):
	print(a.count(i + 1))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#整数の入力
N = int(input())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

ans = 0
for i in range(len(A_list)):
  ans = A _list.count(i+1)
  print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=int(input())
b=input().split()
l=[]
for i in b:
  l.append(int(i))
i=0
while i<len(a):
  if i!=len(a)-1:
    print(l.count(i+1))
  else:
    print(l.count(i+1),end="")
  i+=1

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int(input())))
anslist=[]
for x in range(N):
  print((A+1).count(x))

Submission status: Runtime Error

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

counter = 0
for i in range(1, N):
  for j in range(N):
    if A[j] == i:
      counter += 1
  print(counter)
  counter = 0

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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


def main():
    n = int(input())
    a = list(map(int, input().split()))
    table = [0] * (10**5+5)
    for i in range(len(a)):
        table[a[i]-1] += 1

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


main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import Counter


n = int(input())
a = list(map(int,input().split()))
a_cnt = Counter(a).most_common()
for i in range(1, n+1):
    if i in a:
        if a_cnt[i-1]:
            print(a_cnt[i-1][1])
        else:
            print(0)
    else:
        print(0)

Submission status: Runtime Error

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

out = [0]*n

for aa in a:
  out[a] += 1

for o in range(len(out)):
  print(o)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

res = [0] * N
for a in As:
    res[a-1] += 1
for r in res:
    print(r)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(map(int,input()))
for i in range(n):
  print(s.count(i+1))

Submission status: Runtime Error

Solution code:
N = int(input())
D = {i: [] for i in range(N)}
A = list(map(int, input().split()))
for i in range(N):
  D[i].append(A[i]-1)
for i in range(N):
  print(len(D[i]))

Submission status: Runtime Error

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

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

def main():
    mod=10**9+7
    N=I()
    A=LI()
    ans=[0]*N
     
     
    for i in range(N):
        ans[A[i]-1]+=1
        
    for i in range(N):
        print(ans[i])

main()