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 numpy as np
n = int(input())
jousi = list(map(int, input().split()))
a = np.zeros(n)
for i in jousi :
    a[jousi[i] -1] += 1
for i in range(len(a)):
    print(int(a[i]))

Submission status: Runtime Error

Solution code:
N=map(int, input())
list=list(map(str, input().split()))
answer={}
for i in range(1, N+1):
  m=0
  for j in range(0, len(list)):
  	if list[j] is str(i):
      m=m+1
    else:
      m=m+0
  answer.append(m)
a_s='\n'.join(answer)
print(a_s)

Submission status: Runtime Error

Solution code:
N = input()
a = input().split()
list_i = [int(b) for b in a]

#print(N)
#print(list_i)

for i in range(N):
  list_i.count(i+1)

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
list_worker = list(map(int, input().split()))
count=np.array([0]*N)

i=0
j=0
new_list = sorted(list_worker)

while i<N:
  if ((i+1) == new_list[j]):
    count[j]=count[j]+1
    j=j+1
    
  if (i+1)!=new_list[j]:
    i=i+1
    


  
while i<N:
 print(count[i])

Submission status: Runtime Error

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

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

for i in a:
    print(ans)

Submission status: Runtime Error

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):
    #print('y')
   # print(i)
    num[y[i]] += 1
for i in range(a):
    print(num[i])

Submission status: Runtime Error

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

# if N >= sum(A):
#     print(N-sum(A))
# else:
#     print(-1)
for x in A:
    count[i] +=1
for i in range(1,N+1):
    print(count[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()
l = [A.index(i+1) for i in range(max(A))]
l.append(N-1)
# print(l)

for i in range(N):
    if i >= len(l)-1:
        print(0)
    else:
        ans = l[i+1]-l[i]
        print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
n = input()
n = int(n)
array_1 = list(map(int, input().strip().split()))
ans_list=list(range(n))

for i in len(array_1+1):
  ans_list.append(array_1.count(i))
  
print(ans_list)

Submission status: Runtime Error

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

def main(i):
  a = A.count(i)
  b = A.pop(0)
  print(a)


for i in range(1,n+1):
  main(i)

Submission status: Runtime Error

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))
print(y)
for i in range(a):
    #print('y')
   # print(i)
    num[y[i]] += 1
for i in range(a):
    print(num[i])

Submission status: Runtime Error

Solution code:
num = int(input())
a = input().split()

s_a = set(a)

dc = {}

l_s = []
for i in a:
  dc[int(i)] = a.count(i)
  
index = 1
k = 0
for i in dc.keys():
  while i + k < index:
  print((str(0) + '\n') * (index-i-k))
    print(0)
    k += 1
  print(dc[i])
  index += 1
  
print((str(0) + '\n') * (num - index))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
from collections import Counter
from scipy.misc import comb
N = int(input())
A = list(map(int, input().split()))

total = 0
answers = np.array([0] * (N + 1), dtype=np.int64)
for number, appearance in Counter(A).items():
    flat = comb(appearance, 2, exact=True)
    minus_one = comb(appearance - 1, 2, exact=True)
    total += flat
    answers[number] = minus_one - flat
answers += total

print(*answers[A], sep="\n")

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
b = dict(Counter(a))
c = list(b.keys())
c.sort()
d = [b[i] for i in c] + [0]
c = [0]+c[:]
#print(c)
#print(d)
e = [1]*(len(b)+1)
#print(e)
#print(a)
#print(d)
print(d[0])
for i in range(n-1):
    #print(e)
    if e[a[i]]==1:
        #print(a[i])
        e[a[i]]=0
        print(d[a[i]])
    else:
        print(0)

Submission status: Runtime Error

Solution code:
N = input()
a = input().split()
list_i = [int(b) for b in a]

print(N)
print(list_i)

for i in range(N):
  print(list_i.count(i+1))

Submission status: Runtime Error

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(boss_list[i + 1])

Submission status: Runtime Error

Solution code:
import math
def main():
    N = map(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 + '\n')
main()

Submission status: Runtime Error

Solution code:
from collections import Counter
sum = int(input())
sub = input().split()
count = Counter(sub)
for i in count.values:
  print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
m = input().split()
m = [int(i) for i in m]
 
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: Runtime Error

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

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

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

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

buka_num = []

for i in range(1,N):
    #tmp_A = A[i:]
    buka_num.append(tmp_A.count(i))
    
buka_num.append(0)
for ele in buka_num:
    print(ele)

Submission status: Runtime Error

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

boss_list = sorted(boss_list, reverse=True)


for i in range(n, 0, -1):
    boss_num = 0
    boss_num = boss_list.index(i-1)
    # boss_list = boss_list[boss_num:]
    del boss_list[:boss_num]

    if i == 0:
        boss_num -= 1

    print(boss_num)

Submission status: Runtime Error

Solution code:
c = int(input())

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

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

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, m, c):
    A -= 1
    print(m -np.nonzero(A)[0].size)
    c +=1
    if c < m:
        return print_sub(A, m, c)
    else:
        return

n= int(input())
A = [int(a) for a in input().split()]
A = np.array(A)
c = 0
print_sub(A, n-1, c)

print("0")

Submission status: Runtime Error

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


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


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

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

Submission status: Runtime Error

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]
    else:
        next_num = infos[start-1]
#for i in ans:
#    print(i)

Submission status: Runtime Error

Solution code:

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

Solution code:
import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, m, c):
    A = np.array(A)
    A -= 1
    print(m -np.nonzero(A)[0].size)
    c +=1
    if c < m:
        return print_sub(A, m, c)
    else:
        return

n= int(input())
A = [int(a) for a in input().split()]
c = 0
print_sub(A, n-1, c)

print("0")

Submission status: Runtime Error

Solution code:
N=input()
A = list(map(int, input().split()))
for i in range(1,N+1):
    print(str(A.count(i))+"\n")

Submission status: Runtime Error

Solution code:
#からの配列
l = []
amount = 0
for i in range(N):
    for j in range(N-1):
        if numbers[j] == i+1:
            #print('numbers = {}'.format(numbers[j]))
            amount = amount + 1
    #print('amount = {}'.format(amount))
    l.append(amount)
    #print('l[{}] = {}'.format(i,l[i]))
    #print('--------------------')
    amount = 0

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
import numpy as np
#from numba import njit

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

#NMAX = max(A)
#@njit
def keisan(A,i):
    ans = A.count(i)
    print(ans)

for i in range(1,N):
    
    keisan(A,i)
    #ans = A.count(i)
    #print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
emp = list(map(int,input().split()))
for i in range(N):
    print(emp.count(i+1))
    emp.remove(i+1)

Submission status: Runtime Error

Solution code:
 = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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()))).sort()
moji=A[0]
count=1
i=0
length=len(A)-1
j=0
sougou=0
while(i!=length):

    if moji==A[i+1]:
        count+=1
        i+=1
        j+=1
    else:
        sougou += 1
        print(count)
        count=1
        j=1
        i+=1
        moji=A[i]
if j>=1:
    sougou += 1
    print(count)
for _ in range(N-sougou):print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=int(input())
l=list(map(int,input().split()))
l1=[0]
l1.extend(l)
l2=[]
l1=sorted(l1)
for i in range(a-1):
    if l1[i]<l1[i+1]:
        print(l.count(l[i+1]))
    else:
        print("0")

Submission status: Runtime Error

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

def main(i):
  a = count(A.count(i))
  print(a)


for i in range(1,n+1):
  main(i)

Submission status: Runtime Error

Solution code:
#coding:utf-8
n = int(input())
a = input().split()
lis = [0 for i in range(n)]
count = 0

for i in a:
    lis[int(i - 1)] += 1

for i in lis:
    print("{}".format(i))

Submission status: Runtime Error

Solution code:
N = input()
S = input()

for A in range (int(N)):
    print(S.count(str(A+1,A,int(N)-1))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, m, c):
    A = np.array(A)
    A -= 1
    print(m -len(np.nonzero(A)[0]))
    c +=1
    if c < m:
        return print_sub(A, m, c)
    else:
        return

n= int(input())
A = [int(a) for a in input().split()]
c = 0
print_sub(A, n-1, c)

print("0")

Submission status: Runtime Error

Solution code:
N = input()
S = input()

for A in range (int(N)):
    print(S.count(str(A+1,A,int(N)))

Submission status: Runtime Error

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

for i in range(n):
  for range(len(a)):
    if i in a:
      count++
    print(count\n)

Submission status: Runtime Error

Solution code:
a=int(input())
c=input().split()
for i in range(a-1):
    c[i]=int(c[i])
max1=max(c)
min1=min(c)
if not min1==0: 
    for s in range(min1-1):
        print(0)
for j in range(max1-s):
    print(c.count(j+1+s))
for k in range(a-max1):
    print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

c=Counter(a)
ck=list(Counter(a).keys())
for i in range(1,n+1):
    if i in ck:
        print(c[i])
    else:
        print(0)

Submission status: Runtime Error

Solution code:
ar = [0]*n

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

tmp = ar.pop(0)
ar.append(tmp)
for i in range(n):
    print(ar[i])

Submission status: Runtime Error

Solution code:
#coding:utf-8
n = int(input())
a = input().split()
lis = [0 for i in range(n)]
count = 0

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

for i in lis:
    if count == 0:
        count = 1
        continue
    print("{}".format(i))

Submission status: Runtime Error

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

def main(i):
  a = 0
  for j in A:
    if i = j:
      a = a+1
  print(a)
  

for i in range(1,n+1):
  main(i)

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
A = input().split()
A.insert(0,0)
x = [0]*N
for j in range(N):
    print(c[str(j+1)])

Submission status: Runtime Error

Solution code:
import unittest

from A03 import solve
from A03 import parse_input

class TestA03Solve(unittest.TestCase):

    def test_solve(self):

        lines_as_string = """
5
1 1 2 2
"""

        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), [2,2,0,0,0])

        lines_as_string = """
10
1 1 1 1 1 1 1 1 1
"""

        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), [9,0,0,0,0,0,0,0,0,0]) 


if __name__ == '__main__':
    unittest.main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
a = int(input())
num = np.array(list(map(int,input().split())))
for i in range(1,a+1):
    print(len(num[num==i])

Submission status: Runtime Error

Solution code:
N = int(input())
works = sorted(list(map(int,input().split())))
 
for i in range(1,N + 1):
  print(works.count(i))
  works.remove(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(1,N+1):
    counter = 0
    prev_item = 1
    for item in A:
        if item == i:
            counter += 1
            prev_item = item
    print(counter)
    if i < N:
        A.remove(prev_item)

Submission status: Runtime Error

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

a = [int(i) for i in a]

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

Submission status: Runtime Error

Solution code:
#3
N = int(input())
L = list(map(int, imput().split()))
A = [0] * N
for x in L:
    A[x - 1] += 1

print(*A, sep = '¥n)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, Ones, m, c):
    A = np.array(A)
    A = A -Ones
    print(m -len(np.nonzero(A)[0]))
    c +=1
    if c < m:
        return print_sub(A, Ones, m, c)
    else:
        return

n= int(input())
A = [int(a) for a in input().split()]
Ones = np.array([1]*(n-1))
c = 0
print_sub(A, Ones, n-1, c)

print("0")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

L = []
for i in range(N-1):
  L.append(0)

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

for j in range(N-1):
  print(L[j])

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())
a = list(map(int, input().split()))
jousi={}
for i in range(N):
    itmp=str(i)
    jousi[itmp]=0
for i in range(N-1):
    atmp=str(a[i])
    jousi[atmp]+=1
for i in range(1,N+1):
    print(jousi[str(i)])

Submission status: Runtime Error

Solution code:
n = int(input())

ls = list(map(int, input().split()))
list.sort()

rg = range(1, n + 1)

for i in rg:
    print(ls.count(i))
    ls.remove(i)

Submission status: Runtime Error

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

b =[0]*n

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

for i in b:
    print(i)

Submission status: Runtime Error

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

B = []
for i in range(0,N-1):
    B.append(0)
    for j in range(i,N-1):
        if A[j] == i+1:
            B[i] += 1
for i in range(0,N-1):
    print(B[i]+"\n")

Submission status: Runtime Error

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

for i in range(1,N+1):
    rank.append(A.count(i))
    


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

Submission status: Runtime Error

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

a_set = set(a_li)

for i in range(1, n+1):
  if i in a_set:
    print(a_li.count(i))
    else:
      print(0)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, Ones, m, c):
    A = np.array(A)
    A = A -Ones
    print(n-1 -len(np.nonzero(A)[0]))
    c +=1
    if c < m:
        return print_sub(A, Ones, m, c)
    else:
        pass

n= int(input())
A = [int(a) for a in input().split()]
Ones = np.array([1]*(n-1))
c = 0
print_sub(A, Ones, n-1, c)

print("0")

Submission status: Runtime Error

Solution code:
num = int(input())
hoge = list(map(int, input().split()))
fuga = 0
for i in range(num):
  count = 0
  for j in range(fuga, num):
    if hoge[j] == i + 1:
      count += 1
  fuga += count
  print(count)

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
A = deque(map(int, input().split()))

C = collections.Counter(A)

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

Submission status: Runtime Error

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

buka_num = []

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

buka_num.append(0)

print(buka_num, sep='¥n')

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = []
    for _ in range(N):
        ans.append(0)
    for i in A:
        ans[A[i]-1]+=1
    for j in ans:
        print(j)
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
As = list(map(int, input().split()))
sort_as = sorted(As)
shine = [x + 1 for x in range(N)]
c = 0
s = 0
j = 0
for x in range(N):
  if len(As) == 0:
    print(0)
    continue
  for y in range(len(As)):
    if shine[x] == As[y]:
      c += 1
  print(c)
  c = 0
  if len(As) != 0:
    As.remove(shine[x])

Submission status: Runtime Error

Solution code:
import collections

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

ans = [0] * n;

c = collections.Counter(A)
key = list(c.keys());
value = list(c.values());

for i in key:
  ans[i-1] = value[i-1];
  
for a in ans:
  print(a);

Submission status: Runtime Error

Solution code:
N = input()
l = map(int, input.split())
cnt = 0
cnt_l = []
for j in range(2, N+1):
    for i in l:
        if i == j:
            cnt += 1
    cnt_l.append(cnt)
for c in cnt_l:
    print(c)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = input()
S = input()

for A in range int(N):
    print(S.count(str(A+1)))

Submission status: Runtime Error

Solution code:
N = int(input())
As = list(map(int, input().split()))
sort_as = sorted(As)
shine = [x + 1 for x in range(N)]
c = 0
s = 0
j = 0
for x in range(N):
  if len(As) == 0:
    continue
  for y in range(len(As)):
    if shine[x] == As[y]:
      c += 1
  print(c)
  c = 0
  if len(As) != 0:
    As.remove(shine[x])

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
As = list(map(int, input().split()))
sort_as = sorted(As)
shine = [x + 1 for x in range(N)]
c = 0
s = 0
j = 0
for x in range(N):
  for y in range(len(As)):
    if shine[x] == As[y]:
      c += 1
  print(c)
  c = 0
  if len(As) != 0:
    As.remove(shine[x])

Submission status: Runtime Error

Solution code:
N = input()
S = "".join.(input().split())

for A in range int(N):
    print(S.count(str(A+1)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
sum = sum(a)
if n >= sum:
    print(n - sum)
else:
    print(-1)

Submission status: Runtime Error

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

buka_num = []

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

buka_num.append(0)

print(buka_num, sep='¥n')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from itertools import repeat

n = int(input())
lis = list(map(int, input.split()))
d = [[0] for i in repeat(None, n)]

for i in lis:
  d[i - 1][0] += 1
  
for i in d:
  print(i[0])

Submission status: Runtime Error

Solution code:
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;
import java.math.BigInteger;
 
public class Main
{  
 
    //Life's a bitch
    public static boolean[] sieve(long n)
    {
        boolean[] prime = new boolean[(int)n+1];
        Arrays.fill(prime,true);
        prime[0] = false;
        prime[1] = false;
        long m = (long)Math.sqrt(n);
        for(int i=2;i<=m;i++)
        {
            if(prime[i])
            {
                for(int k=i*i;k<=n;k+=i)
                {
                    prime[k] = false;
                }
            }
        }
        return prime;
    } 
 
    
    static long GCD(long a,long b)
    {
        if(b==0)
        {
            return a;
        }
        return GCD(b,a%b);
    }
 
    static long CountCoPrimes(long n)
    {
        long res = n;
        for(int i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                while(n%i==0)
                {
                    n/=i;
                }
                res-=res/i;
            }
        }
        if(n>1)
        {
            res-=res/n;
        }
        return res;
    }
 
 
    
 
    
 
    static boolean prime(int n)
    {
        for(int i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                return false;
            }
        }
        return true;
    }

    
 
   
 
 
   
   
  
    public static void main(String[] args) throws IOException
    {
     
        new Main().run();
       
    }
 
 
    
    static long LCM(long a,long b)
    {
        return (a*b)/GCD(a,b);
    }
   
 
    Scanner in = new Scanner(System.in);
    // static int[] arr,tree[],lev;
    void run() throws IOException
    {
       long n = nl();
       int[] a = new int[(int)n];
       for(int i=1;i<n;i++)
       {
            int ai = ni();
            a[ai-1]++;
       }

       for(int i=0;i<n;i++)
       {
            System.out.println(a[i]);
       }
         
       
      


           

    
    }





   
    




   
    
    


    




  

    

    

    
    


    
    


   

 

    
 
 
 
 
 
 
    
 
    //xor range query
    static long xor(long n)
    {
 
        if(n%4==0)
        {
            return n;
        }
        if(n%4==1)
        {
            return  1;
        }
        if(n%4==2)
        {
            return n+1;
        }
        return 0;
    }
 
    static long xor(long a,long b)
    {
        return xor(b)^xor(a-1);
    }
 
 
    
 
  
   
    
 
    
       
    
 
    
   
  
 
 
 
   
 
     void printL(long a)
    {
        System.out.println(a);
    }
    void printS(String s)
    {
        System.out.println(s);
    }
 
     void printD(Double d)
    {
        System.out.println(d);
    }
  
   
   
    static void swap(char[] c,int a,int b)
    {
        char t = c[a];
        c[a] = c[b];
        c[b] = t;
    }
 
    static long max(long n,long m)
    {
        return Math.max(n,m);
    }
    static long min(long n,long m)
    {
        return Math.min(n,m);
    }
 
    double nd() throws IOException
    {
        return Double.parseDouble(in.next());
    }
    int ni() throws IOException
    {
        return Integer.parseInt(in.next());
    }
 
    long nl() throws IOException
    {
        return Long.parseLong(in.next());
    }
 
    String si() throws IOException
    {
        return in.next();
    }
 
 
  
   
    static long abs(long n)
    {
        return Math.abs(n);
    }
 
    static class Scanner 
    {
        StringTokenizer st;
        BufferedReader br;
 
        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}
 
        public String next() throws IOException 
        {
            while (st == null || !st.hasMoreTokens()) 
            {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }
 
        public int nextInt() throws IOException {return Integer.parseInt(next());}
        
        public long nextLong() throws IOException {return Long.parseLong(next());}
 
        public String nextLine() throws IOException {return br.readLine();}
 
        public boolean ready() throws IOException {return br.ready();}
 
 
    }
 
    
}
 
 
 
class Pair implements Comparable<Pair>
{
   int x,y;
    public Pair(int x,int y)
    {
        this.x = x;
        this.y = y;
    }
    public int compareTo(Pair o)
    {
        return this.y-o.y;
    }
}

Submission status: Runtime Error

Solution code:
N=int(input())

b=input().split()
counter_list=[]
for i in range(N) :
	count=0
	for item in b :
    	if str(i+1)==item :
        	count+=1
    print(count)

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):
  tmp_A = A[i:]
	buka_num.append(tmp_A.count(i))

buka_num.append(0)

print(buka_num, sep='¥n')

Submission status: Runtime Error

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

result = [0]*N

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

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