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:
n = input()
#a = list(map(int, input().split()))
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 = list(int, input().split()))

print(0)
for i in range(len(a)):
    print(a.count(i))

Submission status: Runtime Error

Solution code:
ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
buka = [0 for i in range(ninnzuu)]
for i in range(1, ninnzuu + 1):
    buka[joushi[i] - 1] += 1
for i in range(ninnzuu):
  print(buka[i])

Submission status: Runtime Error

Solution code:
N = int(input())
ls = list(map(int, input()))
anls = [0]*(N+1)
for i in ls:
    anls[i] += 1
for i in range(1,N+1):
    print(anls[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
B = {}#辞書作成
N = int(input())
A = list(map(int, input().split()))


for i in range(N):
    #B[i+1] = 0
print(B)
for j in A:
    #B[j] += 1
print(B)
for k in B.values():
    print(k)

Submission status: Runtime Error

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

for i in range(1,N+1):
    B[i] = 0
for j in A:
    B[j] += 1
for k in B.values():
    print(k)

Submission status: Runtime Error

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

for i in range(N):
    B[i+1] = 0
for j in A:
    B[j] += 1
for k in B.values():
    print(k)

Submission status: Runtime Error

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

for i in range(N):
    B[i] = 0
for j in A:
    B[j] += 1
for k in B.values():
    print(k)

Submission status: Runtime Error

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

for i in range(N):
    B[i] = 0
for j in A:
    B[j] += 1
for k in B.values():
    print(k)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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 collections

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

n =int(input())
s = list(map(int,input().split()))
l =[0]*n
print(l)
while i < n-2 :
     l[s[i]-1] += 1
     i += 1
for _ in range(n):
     print(l[_])

Submission status: Runtime Error

Solution code:
A=input().split()
N=int(A[0])
del A[0]
B=[]
for i in range(N):
    B.append(0)
for i in range(N-1):
    B[int(A[i])-1]+=1
for i in range(N):
    print(B[i])

Submission status: Runtime Error

Solution code:
A=input().split()
N=int(A[0])
del A[0]
B=[]
for i in range(N):
    B.append(0)
for i in range(N-1):
    B[int(A[i])-1]+=1
print(B)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
def main():
	input = sys.stdin.readline
    N = int(input())
    A = [x for x in input().split()]
    l = [0] * N
    B = set(A)
    C = list(B)
    for i in C:
        l[int(i)-1] = A.count(i)
    for i in range(N):
        print(l[i])
        
main()

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
A = np.array(input().split()).astype(float)

res = np.sum(A == np.arange(1,N+1).reshape(N,1), axis= 1)
for i in range(N):
    print(res[i])

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
A = np.array(input().split()).astype(int)

res = np.sum(A == np.arange(1,N+1).reshape(N,1), axis= 1)
for i in range(N):
    print(res[i])

Submission status: Runtime Error

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

for n in range(N):
    print(A.count(n+1))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
A_list = list(map(int, input().split()))
index = np.arange(1, N+1)
ans = ["{}\n".format(i) for A_list.count(i) in range(1, N+1)]
print(ans)

Submission status: Runtime Error

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

for e in A[1:]:
  print(e)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

for i in B:
    print(i)

Submission status: Runtime Error

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

for e in b:
  print(e)

Submission status: Runtime Error

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

Submission status: Runtime Error

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


def solve(tc):
    n = int(stdin.readline().strip())
    ai = list(map(int, stdin.readline().split()))

    adj = [[] for i in range(n)]
    for i in range(n - 1):
        adj[ai[i] - 1].append(i + 1)

    for children in adj:
        print(len(children))



LOCAL_TEST = not __debug__
if LOCAL_TEST:
    infile = __file__.split('.')[0] + "-test.in"
    stdin = open(infile, 'r')

tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1

Submission status: Runtime Error

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

jyoshi=[0]*n
for i in range(n-1):
  jyo=a[i]
  jyoshi[jyo-1]=jyoshi[jyo-1]+1
  
for k in jyoshi:
  print k

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    a=map(int,input().split())
    b=list(map(int,input().split()))
    c=[]
    times=0
    for i in range(0,a,):
        d=b[i]
        for t in range(0,a,):
            if d==t:
                times=times+1
        c.append(times)

    for item in c:
        print(item,end='')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

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

Submission status: Runtime Error

Solution code:
import numpy as np
#A = np.array([int(i) for i in input().split()])
#A = [int (x) for x in input().split()]
#N=int(input())

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

Submission status: Runtime Error

Solution code:
import numpy as np
#A = np.array([int(i) for i in input().split()])
#N=int(input())

N=int(input())
A = np.array([int(i) for i in input().split()])
p=np.zeros(N)
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# In peace, in love, in war, everything is the same

import math

deg = [0] * 100005
n=int(input())
ar = list(map(int, input().split()))

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

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

Submission status: Runtime Error

Solution code:
N=int(input())
a=list(map(int,input().split()))
for i in N-1:
  C=a.count(i+1)
  print(C)
print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for a in A:
       ans[a] +=1

print(ans)

Submission status: Runtime Error

Solution code:
n=int(inptu())
l=[int(i) for i in input().split()]
f=[0 for i in range(n)]
s=set(l)
for i in s:
  f[i-1]=l.count(i)
print(*f)

Submission status: Runtime Error

Solution code:
EN = input().split()
Bc = [0] * int(EN[0])

tmp = input().split()
BossN = [int(s) for s in tmp]

for i in tmp:

    Bc[i-1] = Bc[i-1] + 1

print(*Bc,sep='\n')

Submission status: Runtime Error

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

m = 0
t = 0

for i in range(1, n):
    count = A.count(i)
    print(count)
    m += count
    t = i
    if m == n - 1:
        break
for _ in range(t, n):
    print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = input().split()
A = [int(n) for n in A]
for i in range(N):
  count = 0
  for j in range(len(A)):
	if i+1 == A[j]:
	  count += 1
  A.pop(i+1)
  print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
k

Submission status: Runtime Error

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

for k in range(1,n+1):
    print(s.count(k))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
a=input().split()
a=sorted(a)
count=1
ans=0

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

if a[-2]==a[-1]:
  print(count)
  ans+=1
else:
  print(1)
  ans+=1
  
if ans!=n:
  for i in range(n-ans):
    print(0)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

def count(N,A):
    for i in range(N):
        print(A.count(i+1))
        A.remove(i+1)
count(N,A)

Submission status: Runtime Error

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

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

for i in id:
	print(i

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
l = []
for _ in range(N):
    l.append(input())
from collections import Countor as C
l = dict(C(l))
for x in range(1,N+1):
    print(l.get(x))

Submission status: Runtime Error

Solution code:
// C/C++ キーワード定義ファイル 関数
// cpp_kw3_functions.kwd
//
//  Created on: 2015/06/13
//      Author: KeitetsuWorks
// CASE=True

#define
#elif
#else
#endif
#error
#if
#ifdef
#ifndef
#include
#line
#pragma
#undef
abort
abs
acos
asctime
asin
assert
atan
atan2
atexit
atof
atoi
atol
bsearch
calloc
ceil
clearerr
clock
cos
cosh
ctime
difftime
div
errno
exit
exp
fabs
fclose
feof
ferror
fflush
fgetc
fgetpos
fgets
floor
fmod
fopen
fprintf
fputc
fputs
fread
free
freopen
frexp
fscanf
fseek
fsetpos
ftell
fwrite
getc
getchar
getenv
gets
gmtime
isalnum
isalpha
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
labs
ldexp
ldiv
localeconv
localtime
log
log10
longjmp
malloc
mblen
mbstowcs
mbtowc
memchr
memcmp
memcpy
memmove
memset
mktime
modf
perror
pow
printf
putc
putchar
puts
qsort
raise
rand
realloc
remove
rename
rewind
scanf
setbuf
setjmp
setlocale
setvbuf
signal
sin
sinh
sprintf
sqrt
srand
sscanf
strcat
strchr
strcmp
strcoll
strcpy
strcspn
strerror
strftime
strlen
strncat
strncmp
strncpy
strpbrk
strrchr
strspn
strstr
strtod
strtok
strtol
strtoul
strxfrm
system
tan
tanh
time
tmpfile
tmpnam
tolower
toupper
ungetc
va_arg
va_end
va_start
vfprintf
vprintf
vsprintf
wcstombs
wctomb

Submission status: Runtime Error

Solution code:
from collections import Counter
n =int(input())
a = list(map(int, input().split()))
s = Counter(a)
for v in s.values():
    print(v)
for i in range(n - len(ans)):
    print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for C in c:
  print(C)

Submission status: Runtime Error

Solution code:
N = int(input())
boss_ids = [int(e) for e in input().split()]
for i in xrange(1, N+1):
  result = 0
  for j in xrange(N-1):
    if boss_ids[j] == i:
      result += 1
  print(result)

Submission status: Runtime Error

Solution code:
N = int(input())
A_list = list(map(int, input().split()))
A_set = sorted(set(A_list), reverse=True)
A_output = []
for i in range(len(A_set)):
    A_output[i] =len(A_list) - len(A_list.remove(A_set[i]))
    
print(A_output.reverse)

Submission status: Runtime Error

Solution code:
N = int(input())
A=[int(i) for i in input().split()]

B = [0 for i in range(len(A))]
for i in A:
    B[i] =B[i] + 1

for i in B:
    print(i)

Submission status: Runtime Error

Solution code:
N = int(input())
A=[int(i) for i in input().split()]

B = [0 for i in range(len(A))]
for i in A:
    B[i] =B[i] + 1

for i in range(B):
    print(i)

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
#s = [0,]*(N-1)
s = []
for i in range(N-1):
    #s[i] = int(input())
    s.append(int(input()))

ct = collections.Counter(s)

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

Submission status: Runtime Error

Solution code:
from collections import Counter

N = int(input())
#s = [0,]*(N-1)
s = []
for i in range(N-1):
    #s[i] = int(input())
    s.append(int(input()))

ct = Counter(s)

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

Submission status: Runtime Error

Solution code:
from collections import Counter

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    s[i] = int(input())

ct = Counter(s)

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

Submission status: Runtime Error

Solution code:
def resolve():
    n = int(input())
    woker = list(map(int, input().split()))
    woker_count = collections.Counter(woker)
    for i in range(n):
        print(woker_count[i + 1])


resolve()

Submission status: Runtime Error

Solution code:
from collections import Counter

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    #s[i] = ''.join(sorted(list(input())))
    s[i] = int(input())

ct = Counter(s)

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

Submission status: Runtime Error

Solution code:
from collections import Counter

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    #s[i] = ''.join(sorted(list(input())))
    s[i] = int(input())

ct = Counter(s)

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

Submission status: Runtime Error

Solution code:
from collections import Counter

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    #s[i] = ''.join(sorted(list(input())))
    s[i] = int(input())

ct = Counter(s)

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(0, n - 1):
    a.append(int(input()))

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Num=[0]*(N+1)

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

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(s) for s in input().split(" ")]

Max=max(A)


for i in range(1,Max+1):
    count=0
    if i==1:
        pos=A.pop(0)
    while pos==i:
        count+=1
        pos=A.pop(0)
        if A==[]:
            count+=1
            break
    print(count)

for i in range(N-Max):
    print(0)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]

    ans = {}

    for i in range(len(A)):
        if A[i] in ans:    # キーの存在確認
            ans[A[i]] += 1
        else:
            ans[A[i]] = 1
    
    for i in range(1, N):
        if i in ans:
            print('{}'.format(ans[A[i]]))
        else:
            print('{}'.format(0))

    print('{}'.format(0))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
n = int(input().strip().split())
arr = [int(i) for i in input().strip().split()]
result = {i:0 for i in range(1, n + 1)}
for i, j in enumerate(arr, 2):
    result[j] += 1
    
for i in result.values():
    print(i)

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(s) for s in input().split(" ")]
R = [0] * (A + 1)
for a in A:
	R[a - 1] += 1
for a in R:
  print(a)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
submap = {}
for each in a:
  try:
    submap[i] += 1
  except:
    submap[i] = 1
for i in range(1, n+1):
  try:
    print(submap[i])
  except:
    print(0)

Submission status: Runtime Error

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

num_subordinates = [0 for _ in N]
for a in A:
	++num_subordinates[a]

for n in num_subordinates:
	print(n)

Submission status: Runtime Error

Solution code:
N = int(input())

A = []

for i in range(N-1):
    A.append(int(input()))

B = []

for j in range(N-1):
    temp = 0
    for i in A:
        if i-2 == j:
            temp += 1
    B.append(temp)        
for j in range(N-1):
    print(B[j])

Submission status: Runtime Error

Solution code:
import math
R, G, B, N = map(int, input().split())
ans = 0
cr = math.ceil(N/R)
cg = math.ceil(N/G)
cb = math.ceil(N/B)
for i in range(cr + 1):
    for j in range(cg + 1):
        tmp =  i * R + j * G
        if N - tmp >= 0 and (N - tmp) % B == 0:
           ans += 1
        elif N - tmp < 0:
          break
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
def count(n, a):
    c = 0
    for i in range(n+1):
        if a[i] == n:
            c += 1
    return c
for j in range(N):
    print(count(j+1, A))

Submission status: Runtime Error

Solution code:
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(N): print(f'{a[i]}')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a=open(0);for i in range(int(n)):print(a.count(str(i+1)))

Submission status: Runtime Error

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

X = list(map(int, input().split())) 
X = sorted(X)

diff = []
for i in range(len(X)-1):
    diff.append(X[i+1] - X[i])

diff_sort = sorted(diff)


if M <= N:
    print(0)    
else:
    print(sum(diff_sort[0:N+1]))

Submission status: Runtime Error

Solution code:
import sys
from functools import lru_cache
sys.setrecursionlimit(10000)

@lru_cache(maxsize = None)
def rec(i, j):
    flag = False
    flag_ = False
    tmp = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - i)
    if tmp > dp[i+1][j]:
        dp[i+1][j] = tmp
        flag = True
    tmp_ = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - N + j + 1)
    if tmp_ > dp[i][j+1]:
        dp[i][j+1] = tmp_ if tmp_ > dp[i][j+1] else dp[i][j+1]
        flag_ = True
    if i + j == N - 1:
        return
    if flag:
        rec(i + 1, j)
    if flag_:
        rec(i, j + 1)
    
N = int(input())
A = sorted([(int(j),i) for i, j in enumerate(input().split())])[::-1]

dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
rec(0, 0)
ans = -1
for i in range(N):
    for j in range(N):
        if dp[i][j] > ans:
            ans = dp[i][j]
print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000)

def rec(i, j):
    flag = False
    flag_ = False
    tmp = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - i)
    if tmp > dp[i+1][j]:
        dp[i+1][j] = tmp
        flag = True
    tmp_ = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - N + j + 1)
    if tmp_ > dp[i][j+1]:
        dp[i][j+1] = tmp_ if tmp_ > dp[i][j+1] else dp[i][j+1]
        flag_ = True
    if i + j == N - 1:
        return
    if flag:
        rec(i + 1, j)
    if flag_:
        rec(i, j + 1)
    
N = int(input())
A = sorted([(int(j),i) for i, j in enumerate(input().split())])[::-1]

dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
rec(0, 0)
ans = -1
for i in range(N):
    for j in range(N):
        if dp[i][j] > ans:
            ans = dp[i][j]
print(ans)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
line= list(map(int,input().split()))
N = line[0]
K = line[1]
#0~Nの連続した整数から
#K個以上(N+1)個以下だけ選ぶ
answer = 0
for i in range (K,N+2):
    minit = i*(i-1)/2
    maximum = (2*N-i+1)*i/2
    
    num = maximum-minit+1
    answer += num
 
if answer >=(10**9+7):
    print(int(answer%(10**9+7)))
    
else:
    print(int(answer))

Submission status: Runtime Error

Solution code:
from sys import stdin,stdout
size = int(stdin.readline())
li = list(map(int,stdin.readline().split()))
"""ans = [0]*size
for i in li:
    if i not in ans:
        ans[i-1] = 1
    else:
        ans[i-1] += 1
for i in ans:
    print(i)
"""
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    stdout.write(i)

Submission status: Runtime Error

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

N, M = map(int, input().split())
A = np.array(list(map(int, input().split())))
tot = np.sum(A)

if tot > N:
	print(-1)
else:
	print(N-tot)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;

int main(){


	map<int,int>ma;

	int n,aux;

	cin >> n;

	for(int i=0;i<n-1;i++){
		cin >> aux;
		ma[aux]++;
	}

	for(int i=1;i<=n;i++)
		cout << ma[i] << endl;

	return 0;
}

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split())
for i in a:
    print(a.count(str(i+1)))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(input())
for i in a:
    print(a.count(str(i+1)))

Submission status: Runtime Error

Solution code:
import collections

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

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

Submission status: Runtime Error

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
freq=[0]*(max(arr)+10)
for i in range(len(arr)):
	freq[arr[i]]+=1
for i in range(1,n+1):
	print(freq[i])

Submission status: Runtime Error

Solution code:
n = int(input())
a_list = map(int input().split())
nl = {str(i):0 for i in range(n)}
for a in a_list:
    nl[str(a-1)] += 1
for v in nl.values():
    print("{}".format(v))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

上司 = list(map(int, input.split(' ')))

for 社員番号 in range(1, 社員数+1):
    print(上司.count(社員番号))

Submission status: Runtime Error

Solution code:
int a[200010];
int ans[200010];
int main(){
int n;
scanf("%d",&n);
for(int i=2;i<=n;i++)scanf("%d",&a[i]); for(int i=2;i<=n;i++)ans[a[i]]++;
for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
b = [len(i for i in a if i == j) for j in range(n+1)]
print(b[1:])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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