CodeEff/ECCO huggingface dataset:
# Original solution
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 998244353
mans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**6)

n = int(eval(input()))
XD = [(-10**10,inf)]
for i in range(n):
  x,d = list(map(int,input().split()))
  XD.append((x,d))
XD.sort()
visited = [0] * (n+1)
def dfs(node):
  visited[node] = 1
  res = 1
  i = node + 1
  while i < n+1:
    if XD[i][0] < XD[node][0] + XD[node][1]:
      if visited[i]:continue
      pro,i = dfs(i)
      res *= pro
      res %= mod
    else: break
  # print(node,res+1)
  return res + 1 , i
print(((dfs(0)[0]-1)%mod))
# print(visited)
# print(XD)
# dfs(1)


# Optimized solution
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 998244353
mans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**6)

n = int(eval(input()))
XD = [(-10**10,inf)]
for i in range(n):
  x,d = list(map(int,input().split()))
  XD.append((x,d))
XD.sort()

def dfs(node):
  res = 1
  i = node + 1
  while i < n+1:
    if XD[i][0] < XD[node][0] + XD[node][1]:
      pro,i = dfs(i)
      res *= pro
      res %= mod
    else: break

  return res + 1 , i
print(((dfs(0)[0]-1)%mod))
# Original solution
from collections import deque


n = int(eval(input()))
info = [list(map(int, input().split())) for i in range(n)]
MOD = 998244353

info = [(10**10, 10 ** 10)] + sorted(info, reverse=True)
dp = [0] * (n + 1)
dp[0] = 1

q = deque([])
for i in range(n):
    if sum(info[i + 1]) <= info[i][0]:
        # 抜かさないとき
        dp[i + 1] = 2 * dp[i]
        dp[i + 1] %= MOD
        q.append((i, info[i]))
    else:
        # 抜かすとき
        if sum(info[i + 1]) <= q[-1][1][0]:
            dp[i + 1] = dp[i] + dp[q[-1][0]]
            dp[i + 1] %= MOD
        else:
            while q:
                q.pop()
                if sum(info[i + 1]) <= q[-1][1][0]:
                    dp[i + 1] = dp[i] + dp[q[-1][0]]
                    dp[i + 1] %= MOD
                    break
print((dp[-1] % MOD))

# Optimized solution
from collections import deque


n = int(eval(input()))
info = [list(map(int, input().split())) for i in range(n)]
info = sorted(info, reverse=True)
MOD = 998244353

dp = [0] * (n + 1)
dp[0] = 1
q = deque([])

for i in range(n):
    # 起動しない場合
    dp[i + 1] += dp[i]
    
    # 起動する場合
    x, d = info[i]
    l, r = x, x + d
    num = 1
    while True:
        if not q:
            q.append((l, num))
            break
        tmp_l, tmp_num = q.pop()
        if r > tmp_l:
            num = tmp_num + num
        else:
            q.append((tmp_l, tmp_num))
            q.append((l, num))
            break
    num = q[-1][1]
    dp[i + 1] += dp[i + 1 - num]
    dp[i + 1] %= MOD
    
print((dp[-1]))
# Original solution
import bisect
import sys
input = sys.stdin.readline


class SegmentTreeRMQ(object):  # 1-indexed
    def __init__(self, size, value):
        self.len = 1 << size.bit_length()
        # print(self.len)
        self.array = [value] * (2 * self.len)

    def update(self, i, x):
        i += self.len
        while i > 0:
            self.array[i] = max(self.array[i], x)
            i >>= 1
        # print(self.array)

    def get(self, i):
        return self.array[i + self.len]

    def query(self, l, r, i, a, b):
        if l == a and r == b:
            return self.array[i]
        center = (a + b) // 2
        if center >= r:
            return self.query(l, r, i * 2, a, center)
        elif center <= l:
            return self.query(l, r, i * 2 + 1, center, b)
        else:
            return max(
                self.query(l, center, i * 2, a, center),
                self.query(center, r, i * 2 + 1, center, b))

    def get_maximum(self, l, r):
        return self.query(l, r, 1, 0, self.len)


N = int(eval(input()))
xd_array = [list(map(int, input().split())) for _ in range(N)]

xd_array = sorted(xd_array, key=lambda x: x[0])
x_array = [i[0] for i in xd_array]
d_array = [i[1] for i in xd_array]

mod = 998244353

tree = SegmentTreeRMQ(N, -1)
ans_array = [0] * (N+1)
ans_array[-1] = 1
for i in range(N-1, -1, -1):
    move = x_array[i] + d_array[i] - 0.1
    max_index = bisect.bisect_left(x_array, move)
    max_move = max(i, tree.get_maximum(i, max_index))
    tree.update(i, max_move)
    ans_array[i] = (ans_array[i+1] + ans_array[max_move + 1]) % mod

print((ans_array[0]))


# Optimized solution
import bisect
import sys
input = sys.stdin.readline


class SegmentTreeRMQ(object):  # 1-indexed
    def __init__(self, size, value):
        self.len = 1 << size.bit_length()
        # print(self.len)
        self.array = [value] * (2 * self.len)

    def update(self, i, x):
        i += self.len
        while i > 0:
            self.array[i] = max(self.array[i], x)
            i >>= 1
        # print(self.array)

    def get(self, i):
        return self.array[i + self.len]

    def get_maximum(self, l, r):
        L = l+self.len
        R = r+self.len
        ANS = -1 << 30

        while L < R:
            if L & 1:
                ANS = max(ANS, self.array[L])
                L += 1

            if R & 1:
                R -= 1
                ANS = max(ANS, self.array[R])
            L >>= 1
            R >>= 1

        return ANS


N = int(eval(input()))
xd_array = [list(map(int, input().split())) for _ in range(N)]

xd_array = sorted(xd_array, key=lambda x: x[0])
x_array = [i[0] for i in xd_array]
d_array = [i[1] for i in xd_array]

mod = 998244353

tree = SegmentTreeRMQ(N, -1)
ans_array = [0] * (N+1)
ans_array[-1] = 1
for i in range(N-1, -1, -1):
    move = x_array[i] + d_array[i] - 0.1
    max_index = bisect.bisect_left(x_array, move)
    max_move = max(i, tree.get_maximum(i, max_index))
    tree.update(i, max_move)
    ans_array[i] = (ans_array[i+1] + ans_array[max_move + 1]) % mod

print((ans_array[0]))
# Original solution
import bisect
import sys


sys.setrecursionlimit(10**6)


def main():
    MOD = 998244353
    N = int(eval(input()))
    robot_list = [list(map(int, input().split())) for _ in range(N)]
    robot_list.sort()  # x座標の昇順でソート
    X = [robot[0] for robot in robot_list]
    D = [robot[1] for robot in robot_list]
    next_robot_list = [-1] * N

    def search_next_robot(r):
        if next_robot_list[r] >= 0:
            return next_robot_list[r]
        if r == N - 1:
            next_robot_list[r] = N
            return N
        if X[r] + D[r] <= X[r + 1]:
            next_robot_list[r] = r + 1
            return r + 1
        next_r_to = bisect.bisect_left(X, X[r] + D[r])
        ret = next_r_to
        for next_r in range(next_r_to - 1, r, -1):
            ret = max(ret, search_next_robot(next_r))
        next_robot_list[r] = ret
        return ret

    for n in range(N - 1, - 1, - 1):
        search_next_robot(n)

    cnt = [0] * (N + 1)
    cnt[0] = 1
    for n in range(N):
        cnt[n + 1] += cnt[n]
        cnt[n + 1] %= MOD
        cnt[next_robot_list[n]] += cnt[n]
        cnt[next_robot_list[n]] %= MOD
    print((cnt[N]))


if __name__ == '__main__':
    main()

# Optimized solution
import bisect
import sys


sys.setrecursionlimit(10**6)
INF = 10**6


class SegTree:

    def __init__(self, N):
        self.N = N
        self.data = [- INF] * (2 * N - 1)

    def update(self, i, x):
        n = self.N + i - 1
        self.data[n] = x
        while n > 0:
            n = (n - 1) // 2
            self.data[n] = max(self.data[2 * n + 1], self.data[2 * n + 2])        

    def elem(self, i):
        return self.data[self.N + i - 1]

    def _query(self, a, b, k, l, r):
        if r <= a or b <= l:
            return - INF
        if a <= l and r <= b:
            return self.data[k]
        val_left = self._query(a, b, 2 * k + 1, l, (l + r) // 2)
        val_right = self._query(a, b, 2 * k + 2, (l + r) // 2, r)
        return max(val_left, val_right)

    def query(self, a, b):
        return self._query(a, b, 0, 0, self.N)


def main():
    MOD = 998244353
    N = int(eval(input()))
    robot_list = [list(map(int, input().split())) for _ in range(N)]
    robot_list.sort()  # x座標の昇順でソート
    X = [robot[0] for robot in robot_list]
    D = [robot[1] for robot in robot_list]

    PW_N = 1
    while PW_N < N:
        PW_N *= 2
    next_robot_tree = SegTree(PW_N)
    next_robot_tree.update(N - 1, N)
    for n in range(N - 2, - 1, - 1):
        if X[n] + D[n] <= X[n + 1]:
            next_robot_tree.update(n, n + 1)
        else:
            next_robot = bisect.bisect_left(X, X[n] + D[n])
            next_robot = next_robot_tree.query(n, next_robot)
            next_robot_tree.update(n, next_robot)

    cnt = [0] * (N + 1)
    cnt[0] = 1
    for n in range(N):
        cnt[n + 1] += cnt[n]
        cnt[n + 1] %= MOD
        next_robot = next_robot_tree.elem(n)
        cnt[next_robot] += cnt[n]
        cnt[next_robot] %= MOD
    print((cnt[N]))


if __name__ == '__main__':
    main()
# Original solution
def main():
    n = int(eval(input()))
    xd = [list(map(int, input().split())) + [i] for i in range(1, n + 1)]
    mod = 998244353
    INF = 10 ** 10

    xd.sort()
    adj = [[] for _ in range(n + 1)]
    stack = [(INF, 0)]
    for x, d, i in xd:
        while stack[-1][0] <= x:
            stack.pop()
        pi = stack[-1][1]
        adj[pi].append(i)
        stack.append((x + d, i))

    stack2 = [0]
    d = [-1] * (n + 1)
    d[0] = 0
    c = [[] for _ in range(n + 1)]
    order = []
    while stack2:
        u = stack2.pop()
        order.append(u)
        for v in adj[u]:
            if d[v] == -1:
                d[v] = d[u] + 1
                c[u].append(v)
                stack2.append(v)

    dp = [1] * (n + 1)
    for u in order[::-1]:
        for v in c[u]:
            dp[u] *= dp[v]
            dp[u] %= mod

        dp[u] += 1
        dp[u] %= mod

    ans = dp[0] - 1
    ans %= mod
    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
def main():
    n = int(eval(input()))
    xd = [list(map(int, input().split())) for _ in range(n)]
    mod = 998244353
    INF = 10 ** 10

    xx = [(x, x + d, i) for i, (x, d) in enumerate(xd, 1)]
    xx.sort()
    c = [[] for _ in range(n + 1)]
    stack = [(INF, 0)]
    for l, r, i in xx:
        while stack[-1][0] <= l:
            stack.pop()

        ip = stack[-1][1]
        c[ip].append(i)
        stack.append((r, i))

    dp = [1] * (n + 1)
    for _, _, u in xx[::-1]:
        for v in c[u]:
            dp[u] *= dp[v]
            dp[u] %= mod

        dp[u] += 1
        dp[u] %= mod

    for v in c[0]:
        dp[0] *= dp[v]
        dp[0] %= mod

    ans = dp[0]
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
import sys
# import collections
# import math
import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    s, t = sys.stdin.read().split()
    n, m = len(s), len(t)
    s = sorted(s)
    t = list(reversed(sorted(t)))
    if n < m:
        for i in range(n):
            f_s, f_t = False, False
            for c in string.ascii_lowercase:
                if s[i] == c: f_s = True
                if t[i] == c: f_t = True
                
                if f_s and not f_t: print('Yes'); exit()
                elif not f_s and f_t: print('No'); exit()
                elif f_s and f_t: break
                else: continue
        ans = 'Yes'
    else:
        for i in range(m):
            for c in string.ascii_lowercase:
                f_s, f_t = False, False
                if s[i] == c: f_s = True
                if t[i] == c: f_t = True
                
                if f_s and not f_t: print('Yes'); exit()
                elif not f_s and f_t: print('No'); exit()
                elif f_s and f_t: break
                else: continue
        ans = 'No'

    print(ans)
        

if __name__ == "__main__":
    # execute only if run as a script
    main()


# Optimized solution
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    s, t = sys.stdin.read().split()
    n, m = len(s), len(t)
    s = sorted(s)
    t = list(reversed(sorted(t)))
    if n < m:
        for i in range(n):
            if s[i] < t[i]: ans = 'Yes'; break
            elif s[i] > t[i]: ans = 'No'; break  
        else:
            ans = 'Yes'
    else:
        for i in range(m):
            if s[i] < t[i]: ans = 'Yes'; break
            elif s[i] > t[i]: ans = 'No'; break  
        else:
            ans = 'No'

    print(ans)
        

if __name__ == "__main__":
    # execute only if run as a script
    main()
# Original solution
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    s, t = sys.stdin.read().split()
    n, m = len(s), len(t)
    s = sorted(s)
    t = list(reversed(sorted(t)))
    if n < m:
        for i in range(n):
            if s[i] < t[i]: ans = 'Yes'; break
            elif s[i] > t[i]: ans = 'No'; break  
        else:
            ans = 'Yes'
    else:
        for i in range(m):
            if s[i] < t[i]: ans = 'Yes'; break
            elif s[i] > t[i]: ans = 'No'; break  
        else:
            ans = 'No'

    print(ans)
        

if __name__ == "__main__":
    # execute only if run as a script
    main()


# Optimized solution
import sys

s, t = sys.stdin.read().split()

def main():
    return 'Yes' if ''.join(sorted(s)) < ''.join(sorted(t))[::-1] else 'No'

if __name__ == '__main__':
    ans = main()
    print(ans)
# Original solution
n=int(eval(input()))
l=list(map(int,input().split()))

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


# Optimized solution
n=int(eval(input()))
l=list(map(int,input().split()))

res=[0]*n

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

for i in res:
    print(i)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
for i in range(1,N+1):
	print((A.count(i)))

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

B = [0]*N
for i in range(N-1):
	B[A[i]-1] += 1
for i in range(N):
	print((B[i]))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = []
for i in range(n + 1):
    if i == 0: continue
    ans.append(a.count(i))

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


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ans = []
sp = 0
c = 0
for i in range(n + 1):
    if i == 0: continue
    for j in range(sp, n - 1):
        if a[j] != i:
            break
        sp += 1
        c += 1
    ans.append(c)
    c = 0

for i in range(n):
    print((ans[i]))
# Original solution
n=int(eval(input()))

lst=list(map(int,input().split(' ')))

final=[0]*n

for i in lst:
    final[i-1]+=1
for i in final:
    print(i)


# Optimized solution
n=int(input())

lst=list(map(int,input().split(' ')))

final=[0]*n

for i in lst:
    final[i-1]+=1
print(*final, sep='\n')
# Original solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

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

# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]
A_cnt = [0 for i in range(N)]

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

for i in range(N) :
	print((A_cnt[i]))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
for i in range(N):
    print((A.count(i + 1)))


# Optimized solution
N = int(input())
s = [0 for i in range(N)]
A = list(map(int, input().split()))
for i in A:
    s[i - 1] += 1
print(*s, sep='\n')
# Original solution
N=int(eval(input()))
A = list(map(int, input().strip().split()))
for i in range(1,N+1):
  print((A.count(i)))

# Optimized solution
n=int(eval(input()))
A = list(map(int, input().split()))
list=[0]*(n+2)

for i in range(n-1):
  list[A[i]]+=1
for i in range(1,n+1):
  print((list[i]))
# Original solution
N = int(eval(input()))
A1 = [0]
Ai = [int(a) for a in input().split()]
A = A1+Ai

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

# Optimized solution
N = int(eval(input()))
A = [0]*N

for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N):
    print((A[j]))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
for i in range (n):
    print((a.count(i+1)))

# Optimized solution
n=int(eval(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))
# Original solution
import collections
n=int(eval(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]))


# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
l=[0]*(n+1)
check=[False]*(n+1)

for i in a:
  l[i]+=1
for i in range(1,n+1):
  print((l[i]))
# Original solution
N=int(eval(input()))
A = list(map(int,input().split()))
for i in range(1,N+1):
    count = 0
    for j in A:
        if i == j:
            count += 1
    print(count)






# Optimized solution
num = int(eval(input()))
table = list(map(int, input().split()))
table2 = []
for i in range(num):
    table2.append(0)
 
for j in range(len(table)):
    table2[table[j]-1] += 1
 
for k in table2:
    print(k)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

for i in range(N-1):
    A[i] -= 1
#上司の社員番号は自分より小さい
dic = {}
for i in range(N):
    dic[i] = 0

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

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
for i in range(N-1):
    A[i] -= 1
ans = [0 for i in range(N)]
for a in A:
    ans[a] += 1
for i in range(N):
    print((ans[i]))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(n):
  print((a.count(i+1)))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
lst=[]
for i in range(n):
    lst.append(0)
for i in a:
    lst[i-1]+=1
for j in lst:
    print(j)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
for i in range(N):
  x = i + 1
  ans = A.count(x)
  print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * N
for i in range(N - 1):
  x = A[i] - 1
  B[x] = B[x] + 1
for i in range(N):
  print((B[i]))
# Original solution

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

# Optimized solution

n = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
k = 0
j = 1
cnt = 0
for i in range(n):
    if i == n-1:
        print(cnt)
        for _ in range(n - j):
            print((0))
    elif j == l[i]:
        cnt += 1
    elif l[i] - j >= 1:
        print(cnt)
        cnt = 1
        a = l[i] - j
        for _ in range(a-1):
            print((0))
        j += l[i] -j
# Original solution
N = int(eval(input()))
works = list(map(int, input().split()))

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

# Optimized solution
N = int(eval(input()))
works = list(map(int, input().split()))
ans = [0] * (N + 1)
 
for i in range(0,N - 1):
  
  ans[works[i]] += 1

ans.pop(0)
for i in ans:
  print(i)
# Original solution
a = int(eval(input()))
b = list(map(int,input().split()))
for i in range(a):
    c = 0
    for num in range(len(b)):
        if i+1 == b[num]:
           c = c + 1
    print(c)
    



# Optimized solution
a = int(eval(input()))
b = list(map(int,input().split()))
c = [0]*a
for i in b:
    c[i-1] += 1
for i in c:
    print(i)
# Original solution
import sys
sys.setrecursionlimit(4100000)
input = sys.stdin.readline
N = int(eval(input())) #社員数
joushi_no_bangou = [0] #上司の社員番号
ans = []
joushi_no_bangou += list(map(int,input().split()))

#==--------------

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

# Optimized solution
N = int(eval(input()))
As = list(map(int, input().split()))
ct = [0] * N
     
for a in As: #ここがキモ．リスト「As」にはそれぞれの上司が入っていて，その中からaを取り出すので，a=上司になっている．これにより，ctの上司を正確に呼び出すことができる．
    ct[a-1] += 1
     
for c in ct:
    print(c)

#別解
#print(*c,sep='\n')
# Original solution
n = int(eval(input()))
A = list(map(int,input().split()))

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


# Optimized solution
n = int(eval(input()))
A = list(map(int,input().split()))
ans = [0]*(n+1)
for i in range(n-1):
    ans[A[i]]+=1

for i in range(1,n+1):
    print((ans[i]))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

for i in range(1, N):
    s = A.count(i)
    print(s)

print((0))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
tm = [0] * n

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

for i in tm:
    print(i)
# Original solution
N = int(eval(input()))
A = input().split()
for i in range(1, N+1):
    print((A.count(str(i))))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
sub = []
for i in range(0, n):
    sub.append(0)
for j in a :
    sub[j - 1] += 1
for i in sub:
    print(i)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
for i in range(1,N+1):
    counter = 0
    for item in A:
        if item == i:
            counter += 1
    print(counter)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
count_list = [0] * N
for item in A:
    count_list[item-1] += 1
for countitem in count_list:
    print(countitem)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))

b=[0]*(n+1)
for i in range(1,n+1):
    b[i]=a.count(i)

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

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))

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

for i in b:
    print(i)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(1,n+1):
  print((a.count(i)))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
b = [0]*n
for i in a:
  b[i-1]+=1
for i in b:
  print(i)
# Original solution
from collections import Counter
def main():
    n = int(eval(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()

# Optimized solution
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import pi
def main():
    n, *a = map(int, read().split())
    cnt = [0] * n
    for ae in a:
        cnt[ae-1] += 1
    print(*cnt, sep='\n')

if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

A_max = max(A)

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

# Optimized solution
N = int(eval(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(len(ans)):
  print((ans[i]))
# Original solution
# C - management
from collections import Counter


def main():
    N, *A = list(map(int, open(0).read().split()))
    cnt_subordinates = Counter(A)
    ans = [cnt_subordinates[i] for i in range(1, N + 1)]
    print(("\n".join(map(str, ans))))


if __name__ == "__main__":
    main()


# Optimized solution
# C - management
def main():
    N, *A = list(map(int, open(0).read().split()))
    cnt_subordinates = [0] * (N + 1)
    for a in A:
        cnt_subordinates[a] += 1
    print(("\n".join(map(str, cnt_subordinates[1:]))))


if __name__ == "__main__":
    main()
# Original solution
n = int(eval(input()))
al = list(map(int, input().split()))

ans_al = [0]*n

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

for ans in ans_al:
    print(ans)

# Optimized solution
n = int(eval(input()))
al = list(map(int, input().split()))

ans_al = [0]*n

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

for a in al:
    ans_al[a-1] += 1

for ans in ans_al:
    print(ans)
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))

i = 1
while i <= n:
    print((A.count(i)))
    i += 1

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))

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

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