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 = [0, 0]
A.extend(list(map(int, input().split())))
to = [[] for _ in range(N+1)]
for i in range(2, N+1):
    to[A[i]].append(i)
for i in range(1, N+1):
    print(len(to[i]))

Submission status: Accepted

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

for v in a:
    d[v-1] += 1

ans = []
for i in range(n):
    ans.append(str(d[i]))
print("\n".join(ans))

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  ans=[0]*n
  for x in l:
    x-=1
    ans[x]+=1

  for i in ans:
    print(i)

main()
# print(main())

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

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

ans = Counter(A)
for i in range(1, N+ 1):
    print(ans[i])

Submission status: Accepted

Solution code:
#!python3

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


def main():
    d = {i: 0 for i in range(1, N + 1)}
    for a in A:
        d[a] += 1
    
    for ans in d.values():
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n = inp()
    a = inpl()
    ans = [0 for _ in range(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())

import collections

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:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
ans = [0] * n
for aa in a:
    ans[aa - 1] += 1
for i in range(n):
    print(ans[i])

Submission status: Accepted

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

nums = [0] * N
for A in As:
    nums[A-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def examA():
    N = I()

    ans = 0
    print(ans)
    return

def examB():
    N, M = LI()
    A = LI()
    S = sum(A)
    if N>=S:
        ans = N-S
    else:
        ans = -1
    print(ans)
    return

def examC():
    N = I()
    A = LI()
    ans = [0]*N
    for i in range(N-2,-1,-1):
        ans[A[i]-1] +=1
    for v in ans:
        print(v)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    AC=Counter(A)
    for i in range(n):
        print(AC[i+1])

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
l=[0]*n
for x in a:
  l[x-1]+=1
print("\n".join(map(str,l)))

Submission status: Accepted

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

Submission status: Accepted

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


main()

Submission status: Accepted

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

for a in ans :
    print(a)

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:
n = int(input())
lis = list(map(int,input().split()))
num = [0 for i in range(n)]
for nn in lis:
    num[nn-1] += 1
for nn in num:
    print(nn)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
Ans=[0]*n
for a in A:
  Ans[a-1]+=1
for a in Ans:
  print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

from collections import Counter, deque,defaultdict
N =int(input())
A = list(map(int, input().split()))

d = defaultdict(int)
for i in range(len(A)):
    d[A[i]] += 1

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

Submission status: Accepted

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

for a in A:
    print(a)

Submission status: Accepted

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

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:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

d = defaultdict(int)
n = inp()
a = inpl()
for i in a:
    d[i] += 1
for i in range(n):
    print(d[i+1])

Submission status: Accepted

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

import sys
sys.setrecursionlimit(300000)


def solve(N: int, A: "List[int]"):
    ret = [0] * N
    for a in A:
        ret[a - 1] += 1
    for r in ret:
        print(r)
    return

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:
N = int(input())
As = list(map(int, input().split()))
ct = [0] * N

for a in As:
    ct[a-1] += 1

for c in ct:
    print(c)

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = list(iim())

    S = [0] * N
    for ai in A:
        S[ai-1] += 1
    print(*S, sep="\n")

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    n = ii()
    a = li()
    tmp = [0 for i in range(n+1)]
    for i in a:
        tmp[i]+=1
    for i in range(1,n+1):
        print(tmp[i])



main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

N = read_a_int()
A = read_ints()
# 直属の部下だから簡単
cnt = Counter(A)
for i in range(1, N + 1):
    print(cnt[i])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
.

Submission status: Runtime Error

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

result = [0] * N

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<map>

int main(){
    int N;
    std::map<int,int>m;
    for(int i=0;i<N;++i){
        int buf;
        std::cin>>buf;
        m[buf]++;
    }
    for(int i=0;i<N;++i){
        std::cout<<m[i]<<std::endl;
    }
}

Submission status: Runtime Error

Solution code:
from collections import Counter

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

for i in range(n):
    if a[i] > 0:
        l[a[i] - 1] += 1

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

Submission status: Runtime Error

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

for i in range(n):
    l[a[i] - 1] += 1
    
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 (1,n+1)
	print(a.count(i))

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for i in range(n)]
print(len(set(s)))

Submission status: Runtime Error

Solution code:
N = int(input())
num = [0] * (2 * 10 ** 5)
A = list(map(int,input().split()))
for i in range(len(A)):
	num[A[i]] += 1
for i in range(1,N + 1):
	print(num[i])

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

Submission status: Runtime Error

Solution code:
N = int(input())
boss = [0] * N

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

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

Submission status: Runtime Error

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

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

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:
import collections

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


ac = collections.Counter(a)

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

Submission status: Runtime Error

Solution code:
import collections
a=int(input())
b=list(map(int,input().split()))
c=[0]*a
d=collections.Counter(b)
n,m=zip(*d.most_common())
n=list(n)
m=list(m)

for i in n:
    c[i-1]=m[i-1]
for i in range(a):
    print(c[i])

Submission status: Runtime Error

Solution code:
import collections
a=int(input())
b=list(map(int,input().split()))
c=[0]*a
d=collections.Counter(b)
n,m=zip(*d.most_common())
n=list(n)
m=list(m)
for i in n:
    c[i-1]=m[i-1]
print(c)
for i in c:
    print(i)

Submission status: Runtime Error

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

m_list=[]
for i in range(1,s+1):
  m_list[i]=e_list.count(i)

for i in m_list:
  print(m_list[i])

Submission status: Runtime Error

Solution code:
s=int(input())
e_list=dic(map(int,input().split()))
e_dic
for i in range(1,s+1):
  e_dic[i]=e_list.count(i)
 
for i in e_dic.keys():
  print(e_dic[i])

Submission status: Runtime Error

Solution code:
s=int(input())
e_list=list(map(int,input().split())
e_dic={}
for i in range(s):
  e_dic[i]+=1
for j in e_dic.items
 print(e_dic[j].item)

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()))
ans=[0]*n
for i in A:
    ans[i-1]+=1
for j in ans:
    print(j)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,(input().split())))
list_a = [0]*2*100000
for i in a:
  list_a[i] += 1
for i in range(1,N+1):
  print(list_a[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(1,max(a)+1):
  count = a.count(i)
  lst.append(count)
lst.append(0)

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

Submission status: Runtime Error

Solution code:
def main():
  n = int(input())
  A = list(map(int, input().split()))
  
  num = [0] * n
  
  # for i in range(0, n-1):
  #   for k in range(0, len(A)):
  #     if A[k] == i+1:
  #       num[i] += 1
  
  for i in range(0, n-1):
    num[A[i]] += 1
  
  for k in range(1, n+1):    
    print(num[k])
  
main()

Submission status: Runtime Error

Solution code:
import numpy as np

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

worker = list(np.zeros(n, dtype=int))

for i in range(n-1):
    worker[A[i]-1] += 1

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

Submission status: Runtime Error

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

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

for i in mem:
	print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
from collections import defaultdict as ddict
for n in range(N-1):
  A.append(int(input()))

B = ddict(int)
for a in A:
  B[a-1] += 1
for n in range(N):
  print(B[n])

Submission status: Runtime Error

Solution code:
N = int(input())
A = []
from collections import defaultdict as ddict
for n in range(N-1):
  A.append(int(input()))

B = ddict(int)
for a in A:
  B[a-1] += 1
for n in range(N):
  print(B[n])

Submission status: Runtime Error

Solution code:
N = int(input())
A = []
from collections import defaultdict as ddict
for n in range(N):
  A.append(int(input()))

B = ddict(int)
for a in A:
  B[a] += 1
for n in range(N):
  print(B[n])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

for i in a:
  l[i]+=1
print(l[1])
for i in a:
  print(l[i+1])

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = []
  for i in range(N):
    B.append(0)
    
  for i in range(N):
    e = int(A[N-i-1])
    B[e] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N
  for i in range(N):
    e = int(A[N-i-1])
    B[e] = B[e] + 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N
  B = int(B)
  for i in range(N):
    e = int(A[N-i-1])
    B[e] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N
  for i in range(N):
    e = A[N-i-1]
    B[e] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N
  for i in range(N):
    B[A[N-i-1]] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
def main():
  N = input()
  A = [int(x) for x in input().split()]
  
  B = [0] * N
  for i in range(N):
    B[A[N-i-1]] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

Submission status: Runtime Error

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

a = N/2

if a%2 == 1:
    a += 0.5
    a = int(a)

for i in range(1,a):
  print(M.count(i))
  
for i in range(a,N+1):
    print(M.count(i))

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(map(int, input().split()))
t = []
cnt = 2
for a in s:
  try:
    t[a-1].append(cnt)
  except IndexError:
    for _ in range(a-len(t)):
      t.append([])
      t[-1].append(cnt)
for i in range(n-1):
  print(len(t[i]))
print(0)

Submission status: Runtime Error

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

for i in range(n):
    print(l.count(i + 1))
    if l.count(i + 1) > 0:
        l.remove(i + 1)

Submission status: Runtime Error

Solution code:
from math import floor
a,b = input().split()
a = int(a)
b = float(b)
print(int(math.floor(a * b)))

Submission status: Runtime Error

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

for i in range(1, a[-1] + 1):
    if i != a[-1]:
        print(len(a[0: a.index(i + 1)]))
        a = a[a.index(i + 1):]
    else:
        print(len(a))
        print('0\n' * (n - i + 1))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = []
for i in range(1, n+ 1):
    count.append(a.count(i))
    a = a[a.index(a != i)]


for i in count:
    print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

for s in sub:
    print(s)
j

Submission status: Runtime Error

Solution code:
n=int(input())
a=[int(input()) for _ in range(n-1)]

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

Submission status: Runtime Error

Solution code:
N=int(input())
josi = list(map(int,input().split()))
n=1
m=0
count=0
while n<=N:
  m=n
  while m<N:
    if josi[m]=n:
      count = count+1
    m=m+1
  print(count)
  m=0
  count=0

Submission status: Runtime Error

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

ans = [A.count(j) for j in range(1, N)]
ans.append(0)

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int,input().split()))
s=[]
for i in range(N-1):
  b=A.count(i+1)
  s.append(b+"\n")
print(s)

Submission status: Runtime Error

Solution code:
n=int(input())
p=list(map(int,input().split()))
li=[]
for i in range(1,n):
    q=p.count(i)
    li.append(q)
nl=li.split("\n")
print(nl)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
10
1 1 1 1 1 1 1 1 1

Submission status: Runtime Error

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

# 社員番号
a = (int(x) for x in 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: Runtime Error

Solution code:
import numpy as np
N, M = map(int, input().split())

A = list(map(int, input().split()))
         
n = N - np.sum(A)
if(n >= 0):
    print(n)
else:
    print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
 -*- coding: utf-8 -*-

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


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

Submission status: Runtime Error

Solution code:
s = list(open(0))
s = input()

j = [0]*int(s)

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

print(0)

Submission status: Runtime Error

Solution code:
import numpy as np

n = input()
a = np.array([int(i) for i in input().split()])
for i in range(int(n)):
    print(a.count(i+1))

Submission status: Runtime Error

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

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