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

Solution (Python):

def main():
    for _ in inputt(1):
        n,  = inputi()
        A = inputl()
        L = [0] * (n + 1)
        for a in A:
            L[a] += 1
        print("\n".join(map(str, L[1:])))








from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(1000)






BUFSIZE = 8192
class FastIO(io.IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = io.BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(io.IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
    sys.stdout.write(kwargs.pop("split", " ").join(map(str, args)))
    sys.stdout.write(kwargs.pop("end", "\n"))
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip()
inputt = lambda t = 0: range(t) if t else range(int(input()))
inputs = lambda: input().split()
inputi = lambda: map(int, inputs())
inputl = lambda t = 0, k = inputi: map(list, (k() for _ in range(t))) if t else list(k())






def len(a):
    if isinstance(a, range):
        return -((a.start - a.stop) // a.step)
    return builtins.len(a)
def bisect_left(a, x, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    while lo < hi:
        mid = (lo + hi) // 2
        if key(a[mid]) < x: lo = mid + 1
        else: hi = mid
    return lo
def bisect_right(a, x, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    while lo < hi:
        mid = (lo + hi) // 2
        if x < key(a[mid]): hi = mid
        else: lo = mid + 1
    return lo
def insort_left(a, x, key = None, lo = 0, hi = None):
    lo = bisect_left(a, x, key, lo, hi)
    a.insert(lo, x)
def insort_right(a, x, key = None, lo = 0, hi = None):
    lo = bisect_right(a, x, key, lo, hi)
    a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right
def index(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    i = bisect_left(a, x, key, lo, hi)
    if lo <= i < hi and key(a[i]) == x: return a[i]
    if default != None: return default
    raise ValueError
def find_lt(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_left(a, x, key, lo, hi)
    if lo < i <= hi: return a[i - 1]
    if default != None: return default
    raise ValueError
def find_le(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_right(a, x, key, lo, hi)
    if lo < i <= hi: return a[i - 1]
    if default != None: return default
    raise ValueError
def find_gt(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_right(a, x, key, lo, hi)
    if lo <= i < hi: return a[i]
    if default != None: return default
    raise ValueError
def find_ge(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_left(a, x, key, lo, hi)
    if lo <= i < hi: return a[i]
    if default != None: return default
    raise ValueError





class Tree:
    def __init__(n):
        self._n = n
        self._conn = [[] for _ in range(n)]
        self._list = [0] * n
    def connect(a, b):
        pass





class Sieve:
    def __init__(self):
        self._n = 6
        self._list = [2, 3, 5, 7, 11, 13]
    def extend(self, n):
        pass


sieve = Sieve()
def isprime(n):
    pass
def prime(n):
    pass
def factorint(n):
    factordict = defaultdict(int)
    for i in sieve:
        if n <= i * i:
            break
        while not n % i:
            factordict[i] += 1
            n //= i
    if n != 1:
        factordict[n] += 1
    return factordict





if __name__ == "__main__":
    main()

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

Solution (Python):
import numpy as np

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

c = np.bincount(a)[1::]
ans = np.concatenate([c,np.zeros(n-len(c),dtype=np.int64)])
for i in range(n):
    print(ans[i])

Solution (Python):
from collections import Counter

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

C = Counter(A)

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

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

for i in result:
    print(i)

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

Solution (Python):
def solution():
    n = int(input())
    a = [int(aa) for aa in input().split()]
    ans = [0] * n
    for i in a:
        ans[i-1] += 1
    [print(anss) for anss in ans]

solution()

Solution (Python):
N=int(input()) 
A=[0]+list(map(int,input().split(" "))) 
R=[[] for _ in range(N)] 

for i in range(1,N):
    R[A[i]-1].append(i) 

for j in range(N): 
    print(len(R[j]))

Solution (Python):
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])

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

Solution (Python):

n=int(input())
d={}
a=[int(i) for i in input().split()]

for i in a:
    if(d.get(i,None)==None):
        d[i]=0
    d[i]+=1
for i in range(1,n+1):
    if(d.get(i,None)==None):
        print(0)
    else:
        print(d[i])

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

Solution (Python):
from collections import defaultdict

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

buka = defaultdict(int)

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

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

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

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

for i in B:
    print(i)

Solution (Python):
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)

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

Solution (Python):
n = int(input())

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

a_list = [0] * n 

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

for i in a_list:
	print(i)

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

Solution (Python):
def main_function():
    from sys import stdin
    from sys import stdout
    input = stdin.readline
    print = stdout.write

    n = int(input())
    a = list(map(int, input().split()))
    ans = [0] * n
    for who_boss in a:
        ans[who_boss - 1] += 1
    for i in range(len(ans)):
        print(f'{ans[i]}\n')


if __name__ == '__main__':
    main_function()

Solution (Python):
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    c = Counter(A)
    for i in range(1, N+1):
        print(c[i])
    
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
d = {}
for i in a:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1
for j in range(1, n+1):
    if j in d:
        print(d[j])
    else:
        print(0)

Solution (Python):
from collections import Counter
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))


def main():
    N = II()
    A = LI()

    x = Counter(A)

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



if __name__ == "__main__":
	main()

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

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

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

Solution (Python):
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)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
ans=[0]*n

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

for i in ans:
    print(i)

Solution (Python):

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

index = N-1
out = [0 for i in range(N)]

for i in range(index):
  out[Ai[i]-1]+=1

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

Solution (Python):
input = raw_input


n = int(input())
ds = map(int, input().split(" "))

nums = [None] + [0] * n 
for d in ds:
    nums[d] += 1

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
l = []
for n in range(N):
    l.append(0)

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

for result in l:
    print(result)

Solution (Python):
import collections

n = int(input())
arr = [int(_) for _ in input().split()]
counter = collections.Counter(arr)

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

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
ans = [0] * n
for i in range(n - 1):
    ans[a[i] - 1] += 1
print(*ans, sep='\n')

Solution (Python):
def f(N,L):
    S=N*[0]
    for i in range(N-1):
        S[L[i]-1]+=1
    return S
N=int(input())
L=list(map(int,input().split()))
A=f(N,L)
for j in range(N):
    print(A[j])

Solution (Python):
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.int64)
cnt = np.zeros(N+1, dtype=np.int64)

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

for c in cnt[1:]:
	print(c)

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

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

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

Solution (Python):
from collections import Counter
n = int(input())
list_A = list(map(int, input().split()))
list_A = list_A + [i for i in range(1, n+1)]
l = Counter(list_A)
ans = sorted(l.items(), key=lambda x:x[0])

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

Solution (Python):
import sys
import socket

hostnames = ['N551J', 'F551C', 'X553M']
input_file = 'c1.in'




def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():

    cache = {}
    def f(x):
        if x in cache:
            return cache[x]

    n = read_int()
    a = read_int_list()
    s = [[] for i in range(n)]
    for i in range(n - 1):
        s[a[i] - 1].append(i + 1)
    res = [len(x) for x in s]
    res = '\n'.join(map(str, res))
    return res


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()

Solution (Python):

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

Solution (Python):
import numpy as np

def main():
    n = int(input())
    a = list(map(int, input().split()))
    c = np.zeros([n], dtype=int)
    for i in a:
        c[i-1] += 1

    for i in c:
        print(i)


if __name__ == '__main__':
    main()

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

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

for i in range(N-1):
    counter[As[i]-1] += 1

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

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

N = [0]*(n+1)
for a in A:
  N[a] += 1

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

Solution (Python):
import collections
n=int(input())
a=list(map(int,input().split()))
v=collections.Counter(a)
for i in range(1,n+1):
    if i in v:
        print(v[i])
    else:
        print(0)

Solution (Python):


N = int(input())
nums = [int(x.strip()) for x in input().split(' ') ] 
leng = len(nums)+ 1
l = [0] * leng

for num in nums:
    l[num-1] = l[num-1] + 1

for ans in l:
    print(ans)

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

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

Solution (Python):
N=int(input())
A=[int(x) for x in input().rstrip().split()]
ans=[0 for i in range(N)]

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

for i in ans:
  print(i)

Solution (Python):
n = int(input())
lis = list(map(int, input().split()))
dic = {}
for i in lis:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] =1
for i in range(1, n + 1):
    print(dic.get(i, 0))

Solution (Python):
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])

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


boss_list = A

subordinaties = [0] * N
for boss in boss_list:
    index_of_boss = boss - 1
    subordinaties[index_of_boss] += 1

for subodinate in subordinaties:
    print(subodinate)

Solution (Python):
from collections import defaultdict
d = defaultdict(int)
N = int(input())
A = list(map(int, input().split()))

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

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

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
joushi = [0 for i in range(N)]

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

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

ans = [0]*n;

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

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

Solution (Python):
import numpy as np
N = int(input())
A = list(map(int, input().split()))

ans = np.zeros(N)

for i in range(len(A)):
    ans[A[i]-1] += 1

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

Solution (Python):
import collections

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

c = collections.Counter(a)

for i in range(1, n+1):
  if c[i]:
    print(c[i])
  else:
    print('0')

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

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

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

Solution (Python):
n = int(input())
subords = dict()

ords = [int(x) for x in input().split()]

for boss in ords:
    if boss not in subords:
        subords[boss] = 0
    subords[boss] += 1


for boss in range(1, n + 1):
    if boss in subords:
        print(subords[boss])
    else:
        print('0')

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

Solution (Python):
def main():
    n = int(input())
    arr = list(map(int,input().split()))
    counts = [0]*(n+1)
    for i in arr:
        counts[i] += 1

    counts.pop(0)
    for i in counts:
        print(i)
        

main()

Solution (Python):


import sys




import numpy as np



"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        
        
        
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def main():
    
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    
    
    
    
    
    n = int(input())
    a = np.array(ip.IL())
    
    b = np.bincount(a)[1:]
    m = len(b)
    others = np.zeros(n-m).astype(int)
    
    print(*b, sep="\n")
    print(*others, sep="\n")
    

main()

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

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

Solution (Python):
n = int(input())
listA = list(map(int, input().split()))
memL = [0]*n

for i in range(len(listA)):
    memL[listA[i]-1]+=1

for mem in memL:
    print(mem)

Solution (Python):

import sys
from collections import defaultdict
sys.setrecursionlimit(10**8)
INF = float("inf")

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


class Graph(object):
    def __init__(self, N):
        self.N = N
        self.E = defaultdict(list)

    def add_edge(self, src, dest, w=1):
        self.E[src].append((dest, w))


g = Graph(N)
for i in range(N-1):
    g.add_edge(A[i]-1, i+1)

for i in range(N):
    print(len(g.E[i]))

Solution (Python):
from collections import Counter
import numpy as np
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
b = np.bincount(A,minlength=N+1)
for i in range(1, N+1):
    print(b[i])

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

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

Solution (Python):
import sys
import collections


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

ans = collections.Counter(A)

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

Solution (Python):
d = {}
n = int(input())
a = [int(i) for i in input().split()]

for i in range(1,n+1):
  if i not in d:
    d[i] = 0

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

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

Solution (Python):
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()
CNT = [0]*N

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

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

Solution (Python):
from collections import Counter
def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = [0] * n
    ac = Counter(a)
    for i in range(n):
        cnt[i] = ac[i+1]
    for i2 in range(n):
        print(cnt[i2])


if __name__ == '__main__':
    main()

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

d={}
for i in range(n-1):
  if l[i] not in d:
    d[l[i]]=1
  else:
    d[l[i]]+=1

for i in range(n):
  if i+1 in d:
    print(d[i+1])
  else:
    print(0)

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

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

Solution (Python):
inputLine=input()
N=int(inputLine)

inputLine=input()
A=inputLine.split(" ")

result = []
for i in range(N):
    result.append(0)

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

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

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

count_list = [0 for i in range(N)]
for num in A:
  count_list[num-1] += 1

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

Solution (Python):
N = int(input())
A = [int(i) for i in input().split(' ')]
B = [0] * N
for i in A:
	B[i-1] += 1

for i in B:
	print(i)

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

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

Solution (Python):
n = int(input())
a_lst = map(int,input().split())
counts = [0 for _ in range(n+1)]
for a in a_lst:
    counts[a] += 1
    
for cnt in counts[1:]:
    print(cnt)

Solution (Python):
import sys
input = sys.stdin.readline


N = int(input())


huga = list(map(int, input().split()))
L = [0] * N

for n in huga:
  L[n-1] += 1
  
[print(i) for i in L]

Solution (Python):


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

M = {}
for a in A:
    try:
        M[a-1]+=1
    except KeyError:
        M[a-1]=1
for x in range(N):
    try:
        print(M[x])
    except KeyError:
        print(0)

Solution (Python):
from collections import defaultdict
def c163(n, al):

    count = defaultdict(int)

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

    return count

def main():
    n = int(input())
    al = list(map(int, input().split()))
    dilist = c163(n, al)
    for i in range(1 , n + 1):
        try:
            print(dilist[i])
        except:
            print("0")

if __name__ == '__main__':
    main()

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

result = [0]*n

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

Solution (Python):
import sys
input = sys.stdin.readline


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

for i in range(1, N + 1):
	dic[i] = 0

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

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

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

Solution (Python):
import math
N = int(input())
a = list(map(int,input().split()))
c = [0]*(N+1)
for i in range(N-1):
    b = a[i]
    c[b] += 1
for j in range(1,N+1):
    print(c[j])

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = {i:0 for i in range(n+1)}
for i in a:
    ans[i] += 1
ans.pop(0)
for i in ans.items():
    print(i[1])

Solution (Python):
import numpy as np

n = int(input())

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

ans = np.zeros(n, dtype=np.int)

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

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

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
d={}
for i in range(n):
	d[i+1]=0
for i in range(len(l)):
	d[l[i]]+=1
for i in d:
	print(d[i])

Solution (Python):
n = int(input())
P = [int(x)-1 for x in input().split()]
subs = [0]*n
for p in P:
    subs[p] += 1
print(*subs, sep='\n')

Solution (Python):
N = int(input())
Ain = list(map(int,input().split(' ')))

A=[0]

for i in range(N):
    A.append(0)

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

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

Solution (Python):
N = int(input())
boss = (int(x) for x in input().split())
sub = [0] * N
for i in boss:
    sub[i-1] += 1
for i in sub:
    print(i)

Solution (Python):
n = int(input())
p = [int(x) for x in input().split()]

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

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

Solution (Python):


import numpy as np
import math

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

buka_num = np.array([0]*N)

for a in A:
    buka_num[a-1] += 1
    
for b in buka_num:
    print(b)

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

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

cnt_a = [0]*n

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

Solution (Python):
from collections import Counter


N=int(input())

s_list = map(int, input().split())

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

Solution (Python):
import collections

N = int(input())
S = input().split()

c = collections.Counter(list(S))

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

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

Solution (Python):
import collections
n=int(input())
a=list(map(int,input().split()))
m=max(a)
c=collections.Counter(a)
c=c.most_common()
l=[0]*n
for i in range(len(c)):
    l[c[i][0]-1]=c[i][1]
print(l[0])
for j in range(1,n):
    print(l[j])

Solution (Python):


from sys import stdin
from collections import defaultdict


def main():
    N = int(stdin.readline())
    A = list(map(int, stdin.readline().split()))

    B = defaultdict(lambda: 0)
    for a in A:
        B[a] += 1

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


if __name__ == "__main__":
    main()

Solution (Python):
import collections
N = int(input())
A = [int(x) for x in input().split()]
c = collections.Counter(A)

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()
l = [0]*n

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

for i in l:
    print(i)

Solution (Python):
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)

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

buka=[0]*N
for i in A:
    buka[i-1]=buka[i-1]+1
for i in range(N):
    print(buka[i])