Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def resolve():
    readline=sys.stdin.readline
    mod=10**9+7
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    cnt=[0]*60
    for i in range(n):
        b = bin(arr[i])
        lenb = len(b)
        for j in range(2,lenb):
            if int(b[lenb+1-j])==1:
                cnt[j-2]+=1
    ans=[0]*60
    answer = 0
    for i in range(60):
        ans[i]=cnt[i] * (n-cnt[i])
    x=1
    for i in range(60):
        answer += ans[i]*x
        answer %= mod
        x*=2
        x%=mod
    print(answer)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

### FIXED CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def resolve():
    readline=sys.stdin.readline
    mod=10**9+7
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    binArr = [[0 for i in range(60)] for j in range(n)]
    cnt=[0]*60
    for i in range(n):
        b = bin(arr[i])[2:]
        lenb = len(b)
        for j in range(lenb):
            binArr[i][j] = int(b[lenb-1-j])
            cnt[j]+=binArr[i][j]
    ans=[0]*60
    answer = 0
    for i in range(n):
        for j in range(60):
            # 1: cnt[j]
            # 0: n-cnt[j]
            cnt[j]-=binArr[i][j]
            if binArr[i][j] == 0:
                ans[j] += cnt[j]
            else:
                ans[j] += (n-cnt[j]-i-1)
    x=1
    for i in range(60):
        answer += ans[i]*x
        answer %= mod
        x*=2
        x%=mod
    print(answer)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
### BUGGY CODE ###

a,n,m=list(map(int,input().split()))
count=0
for x in range(max(a**n,1),m+1):
    xl=[int(i) for i in list(str(x))]
    y=sum(xl)
    if x==(y+a)**n:count+=1
print(count)


### FIXED CODE ###

a,n,m=list(map(int,input().split()))
count=0
check_list=[]
i=0
if a==0:i=1
while (i+a)**n<m:
    check_list.append((i+a)**n)
    i+=1
for x in check_list:
    xl=[int(i) for i in list(str(x))]
    y=sum(xl)
    if x==(y+a)**n:count+=1
print(count)
### BUGGY CODE ###

N=int(input())
x=1
for i in range(N+1):
 for j in range(i+1):
  if(i==j*j):
   x=i
print(x)
 

### FIXED CODE ###

import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)
### BUGGY CODE ###

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

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

def comb_fast(n,r):
    m = 10**9+7
    res = 1
    for i in range(1,n+1):
        res = res*i%m
    for i in range(1,r+1):
        res = res*mod_inv(i,m)%m
    for i in range(1,n-r+1):
        res = res*mod_inv(i,m)%m
    return res

def two_to(n):
    bi = format(n,"b")
    bi_list = list(bi)
    bi_list.reverse()
    s = 1
    for i in range (0,len(bi_list)):
        if bi_list[i] == "1":
            s *= 2**(2**i)
            s = s%1000000007
    return s

sum = two_to(n)
sub = comb_fast(n,a)+comb_fast(n,b)
ans = sum - sub -1

print(ans)

### FIXED CODE ###

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

mod = 10**9+7

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

sum = pow(2,n,mod)
case = combination(n,a,mod) + combination(n,b,mod) + 1
ans = sum-case
while ans < 0 :
    ans += mod

print(ans)
### BUGGY CODE ###

n,m,l = map(int,input().split())
g = [[1<<30]*n for _ in range(n)]
for _ in range(m):
  a,b,c = map(int,input().split())
  g[a-1][b-1] = c
  g[b-1][a-1] = c
for i in range(n):
  g[i][i] = 0

def bell(g,n):
  for k in range(n):
    for i in range(n-1):
      for j in range(i+1,n):
        if g[i][j] > g[i][k] + g[k][j]:
          g[i][j] = g[i][k] + g[k][j]
          g[j][i] = g[i][j]
  return g

g = bell(g,n)
for i in range(n):
  for j in range(n):
    if i == j:
      g[i][j] = 0
    elif g[i][j] <= l:
      g[i][j] = 1
    else:
      g[i][j] = 1<<30
g = bell(g,n)

q = int(input())
for _ in range(q):
  s,t = map(int,input().split())
  if g[s-1][t-1]>>30:
    print(-1)
  else:
    print(g[s-1][t-1]-1)

### FIXED CODE ###

n,m,l = map(int,input().split())
g = [[1<<30]*n for _ in range(n)]
for _ in range(m):
  a,b,c = map(int,input().split())
  g[a-1][b-1] = c
  g[b-1][a-1] = c
for i in range(n):
  g[i][i] = 0

def bell(g,n):
  for k in range(n):
    for i in range(n-1):
      for j in range(i+1,n):
        if g[i][j] > g[i][k] + g[k][j]:
          g[i][j] = g[i][k] + g[k][j]
          g[j][i] = g[i][j]
  return g

g = bell(g,n)
for i in range(n):
  for j in range(n):
    if i == j:
      g[i][j] = 0
    elif g[i][j] <= l:
      g[i][j] = 1
    else:
      g[i][j] = 1<<30
g = bell(g,n)

q = int(input())
for _ in range(q):
  s,t = map(int,input().split())
  if g[s-1][t-1]>>30:
    print(-1)
  else:
    print(g[s-1][t-1]-1)
### BUGGY CODE ###

n = int(input())

power = 1
for i in range(n):
    power *= (i+1)%1000000007

print(power%(1000000007))


### FIXED CODE ###

n = int(input())

power = 1
for i in range(n):
    power = power * (i+1)%1000000007
    power %= 1000000007

print(power)
### BUGGY CODE ###

n = int(input())

tt = list(map(int, input().split()))
v = list(map(int, input().split()))

time = sum(tt);

border = [0] *(n+1)
start_v = [0] *(n+1)
end_v = [0] *(n+1)

temp = 0
for i in range(n):
	temp += tt[i]
	border[i+1] = temp
	start_v[i] = v[i]
	end_v[i+1] = v[i]

t = 0
idx = 0
ans = 0
vlast = 0
v0 = 0

# print (border)
while t < time :
	t += 0.5

	#直接制約
	v0 = v[idx]
	if t == border[idx+1]:
		idx += 1
#		v0 = min(v0, v[idx])

	for j in range(n+1):
		
		if border[j] <= t:
			#前の時刻からの制約
			temp = end_v[j] + (t - border[j])
			if v0 > temp:
				v0 = temp
		if border[j] >= t:
			#後ろの時刻からの制約
			temp = start_v[j] + (border[j] - t)
			if v0 > temp:
				v0 = temp

#	print(v0)

#	ans += 0.5 * (vlast + v0) / 2
	ans += (vlast + v0)
	vlast = v0

ans /= 4.0
print (ans)



### FIXED CODE ###

n = int(input())

tt = list(map(int, input().split()))
v = list(map(int, input().split()))

time = sum(tt);
INF = 999999
border = [0] *(n+1)
start_v = [0] *(n+1)
end_v = [0] *(n+1)

temp = 0
for i in range(n):
	temp += tt[i]
	border[i+1] = temp
	start_v[i] = v[i]
	end_v[i+1] = v[i]

t = 0
idx = 0
ans = 0
vlast = 0
v0 = 0
new_interval = False
limitation_front =0 # 最初の計算に必要

# print (border)
while t < time :
	t += 0.5
	new_interval = False

	#直接制約
	v0 = v[idx]
	if t == border[idx+1]:
		idx += 1
		new_interval = True
#		v0 = min(v0, v[idx])

	if(not new_interval):
		limitation_front += 0.5
		if v0 > limitation_front:
			v0 = limitation_front
	
	if new_interval: 
		limitation_front = INF
		for j in range(n+1):
			if border[j] <= t:
				#前の時刻からの制約
				temp = end_v[j] + (t - border[j])
				if v0 > temp:
					v0 = temp
				if limitation_front > temp:
					limitation_front = temp
			else:
				break
			#print (limitation_front)


	for j in range(n+1):
		if border[j] >= t:
			#後ろの時刻からの制約
			temp = start_v[j] + (border[j] - t)
			if v0 > temp:
				v0 = temp

	#print(v0)

#	ans += 0.5 * (vlast + v0) / 2
	ans += (vlast + v0)
	vlast = v0

ans /= 4.0
print (ans)
### BUGGY CODE ###

import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def unable():
    print(-1)
    exit()

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

from heapq import heappop, heappush
done = set()
heap = []
for i in range(n):
    if a[i] > b[i]:
        unable()
    elif a[i] == b[i]:
        done.add(i)
    elif b[i] >= b[i-1]+b[(i+1)%n]:
        heappush(heap, (-b[i],i))

ans = 0
while heap and len(done) != n:
    _, cur = heappop(heap)
    prv = (cur-1)%n
    nxt = (cur+1)%n
    base = b[prv]+b[nxt]
    cnt1, mod = divmod(b[cur], base)
    if cnt1 == 0:
        if b[cur] == a[cur]:
            done.add(cur)
        continue
    if mod > a[cur]:
        ans += cnt1
        b[cur] = mod
    else:
        cnt2, mod = divmod(b[cur]-a[cur], base)
        if mod != 0:
            unable()
        ans += cnt2
        done.add(cur)
        b[cur] = a[cur]
    if prv not in done:
        heappush(heap, (-b[prv], prv))
    if nxt not in done:
        heappush(heap, (-b[nxt], nxt))

if len(done)==n:
    print(ans)
else:
    unable()


### FIXED CODE ###

import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def unable():
    print(-1)
    exit()

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

from heapq import heappush, heappop
h = []
base = 10**6
for i in range(n):
    if a[i]>b[i]:
        unable()
    else:
        heappush(h, -(b[i]*base+i))

ans = 0
while h:
    k = heappop(h)
    i = -k%base
    cnt, mod = divmod(b[i]-a[i],b[i-1]+b[(i+1)%n])
    if cnt == 0:
        if mod != 0:
            unable()
    else:
        ans += cnt
        b[i] = a[i]+mod
        heappush(h, -(b[i]*base+i))
print(ans)
### BUGGY CODE ###

mod = 10**9 + 7
n = int(input())
A = [int(i) for i in input().split()]
l = 0
for i in range(1,n+1):
	if A.count(i) > 1:
		l = i
		p = []
		for j in range(n+1):
			if A[j] == l:
				p.append(j)
				if len(p) > 1:
					break
		break
	if l:
		break

t = 1
d = 1
for k in range(n+1):

	t *= (n+1-k)%mod
	t %= mod
	t *= pow(k+1,mod-2,mod)
	t %= mod
	if not k:
		print(n)
	elif k <= n+p[0]-p[1]:
		d *= (n+p[0]-p[1]-k+1)%mod
		d %= mod
		d *= pow(k,mod-2,mod)
		d %= mod
		print((t - d)%mod)
	else:
		print(t%mod)



### FIXED CODE ###

from collections import Counter
mod = 10**9 + 7
n = int(input())
A = [int(i) for i in input().split()]
C = Counter(A)
l = 0
for i in range(1,n+1):
	if C[i] > 1:
		l = i
		p = []
		for j in range(n+1):
			if A[j] == l:
				p.append(j)
				if len(p) > 1:
					break
		break
	if l:
		break

t = 1
d = 1
for k in range(n+1):

	t *= (n+1-k)%mod
	t %= mod
	t *= pow(k+1,mod-2,mod)
	t %= mod
	if not k:
		print(n)
	elif k <= n+p[0]-p[1]:
		d *= (n+p[0]-p[1]-k+1)%mod
		d %= mod
		d *= pow(k,mod-2,mod)
		d %= mod
		print((t - d)%mod)
	else:
		print(t%mod)
### BUGGY CODE ###

K = int(input())
if K == 0:
    print(2)
    print(1,1)
    exit()
N = 50
L = list(range(N))
for i in range(K):
    L[i%N] += N + 1
    L = list(map(lambda x:x-1,L))
print(N)
print(*L)

### FIXED CODE ###

K = int(input())
N = 50
L = list(range(N))
q,r = divmod(K,N)
for i in range(N):
    L[i] += N * q + (N if r > i else 0)
    L[i] -= (N-1) * q + (r-1 if r > i else r)
print(N)
print(*L)
### BUGGY CODE ###

def main():
    import sys
    N = int(input())
    input_2 = sys.stdin.readline
    P_list = list(map(int,input_2().split()))
    i_num = 0
    for i in range(N):
        if P_list[i] <= min(P_list[:i+1]):
            i_num += 1
    print(i_num)

if __name__ == "__main__":
    main()

### FIXED CODE ###

N = int(input())
P_list = list(map(int,input().split()))
i_num = 0
min_P = P_list[0]
for p in P_list:
    if p <= min_P:
        min_P = p
        i_num += 1
print(i_num)
### BUGGY CODE ###

import itertools
k, s = map(int, input().split())

data = [i for i in range(k + 1)]
# print(data)
dd = itertools.product(data, repeat=3)
# print(dd)
dd = list(dd)

ans = 0
for i in dd:
    #print(sum(i))
    if (sum(i) == s):
        ans += 1

print(ans)


### FIXED CODE ###

import itertools
k, s = map(int, input().split())

#data = [i for i in range(k + 1)]
# print(data)
#dd = itertools.product(data, repeat=3)
# print(dd)
#dd = list(dd)
#target = s / 3
ans = 0
if (k * 3 < s):

    pass
else:
    for x in range(0, k + 1):
        #temp = s - x
        # 2なら、（０、２）（１、１）（２、０）
        for y in range(0, k + 1):
            if (0 <= s - (x + y) <= k):
                ans += 1

print(ans)

'''
ans = 0
for i in dd:
    #print(sum(i))
    if (sum(i) == s):
        ans += 1

print(ans)
'''
### BUGGY CODE ###

def binary_search(l, item):

    if len(l) == 0 or l[0] <= item:
        return -1

    if item < l[-1]:
        return len(l) - 1

    list2 = [1001] + l + [0]

    low = 0
    high = len(list2) - 1

    while low <= high:
        mid = (low + high) // 2

        bigger = list2[mid]
        smaller = list2[mid+1]

        if smaller <= item and item < bigger:

            return mid - 1

        if smaller > item:
            low = mid + 1

        else:
            high = mid - 1

    return -1

N = int(input())
L = list(map(int, input().split(' ')))

L = sorted(L, reverse=True)


result = 0
for i, a in enumerate(L):
    for j, b in enumerate(L[i+1::]):
        k = binary_search(L[i+j+2::], a-b)

        result += k + 1


print(result)


### FIXED CODE ###

from bisect import bisect_left

N = int(input())
L = list(map(lambda l: int(l)*(-1), input().split()))
L.sort()

result = 0
for i, a in enumerate(L[:-2:]):
    for ii, b in enumerate(L[i+1:-1:]):
        c_list = L[i+ii+2::]
        c_index = bisect_left(c_list, a-b)
        result += c_index

print(result)
### BUGGY CODE ###

INF = float('inf')

N, capW = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(N)]

dp = {0: 0}
for wi, vi in items:
    for w, v in list(dp.items()):
        if w+wi <= capW:
            dp[w+wi] = max(dp.get(w+wi, 0), v+vi)

print(max(dp.values()))


### FIXED CODE ###

INF = float('inf')

N, capW = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(N)]

dp = [-INF] * (capW+1)
dp[0] = 0
for wi, vi in items:
    for w in reversed(range(capW+1)):
        if dp[w] == -INF: continue
        if w+wi <= capW:
            dp[w+wi] = max(dp[w+wi], dp[w] + vi)

print(max(dp))
### BUGGY CODE ###

# Problem D - String Formation

# input process
S = input()
Q = int(input()) # query number

# initialization
sento = 1

# process
for i in range(Q):
    query_num = input()
    # クエリが１の時
    if query_num[0]=="1":
        # 反転処理
        if sento==1:
            sento = 10
        else:
            sento = 1
    else: # query num 2
        n, f, c = query_num.split()
        f = int(f)
        if f==1: # 先頭追加処理
            # 先頭の位置によって変わる
            if sento==1:
                S = c + S
            else:
                S = S + c
        else: # 末尾追加処理
            if sento==1:
                S = S + c
            else:
                S = c + S

# output process
if sento==1:
    print(S)
else:
    print(S[::-1])


### FIXED CODE ###

# Problem D - String Formation

from collections import deque

# input process
S = input().replace("\n", "")
S = deque(list(S))
Q = int(input()) # query number

# initialization
sento = 1

# process
for i in range(Q):
    query_num = input()
    # クエリが１の時
    if query_num[0]=="1":
        # 反転処理
        if sento==1:
            sento = 10
        elif sento==10:
            sento = 1
    elif query_num[0]=="2":
        n, f, c = query_num.split()
        f = int(f)
        if f==1: # 先頭追加処理
            # 先頭の位置によって変わる
            if sento==1:
                S.appendleft(c)
            elif sento==10:
                S.append(c)
        elif f==2: # 末尾追加処理
            if sento==1:
                S.append(c)
            elif sento==10:
                S.appendleft(c)

# output process
if sento==1:
    print("".join(S))
else:
    print("".join(list(S)[::-1]))
### BUGGY CODE ###

from functools import reduce
from math import gcd


k = int(input())
B=list()

for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
        a=[i,j,k]
        b = reduce(gcd,a)
        B.append(b)
print(sum(B))



### FIXED CODE ###

from functools import reduce
from math import gcd
 
 
k = int(input())
B=list()
D=list()
 
for i in range(1,k+1):
  for j in range(1,k+1):
        a=[i,j]
        b = reduce(gcd,a)
        B.append(b)
 
for i in B:
    for k in range(1,k+1):
        c = [i,k]
        d = reduce(gcd,c)
        D.append(d)
print(sum(D))
### BUGGY CODE ###

H, W = map(int, input().split())

S = [["#"] * (W + 2) for i in range(H + 2)]
for i in range(H):
    s = input()
    for j in range(W):
        S[i + 1][j + 1] = s[j]
#print(S)

g = H * W

d = [[float("INF")] * g for i in range(g)]
for i in range(g):
    d[i][i] = 0

for i in range(1, H + 1):
    for j in range(1, W + 1):
        if S[i][j] == ".":
            p = (i - 1)*W + (j - 1)
            if S[i][j+1] == ".":
                d[p][p + 1] = 1
            if S[i][j-1] == ".":
                d[p][p - 1] = 1
            if S[i+1][j] == ".":
                d[p][p + W] = 1
            if S[i-1][j] == ".":
                d[p][p - W] = 1

for k in range(g):
    for i in range(g):
        for j in range(g):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

ans = 0

for i in range(g):
    for j in range(g):
        if d[i][j] != float("INF"):
            ans = max(ans, d[i][j])

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())

S = [["#"] * (W + 2) for i in range(H + 2)]
for i in range(H):
    s = input()
    for j in range(W):
        S[i + 1][j + 1] = s[j]
#print(S)

g = H * W

d = [[float("INF")] * g for i in range(g)]
for i in range(g):
    d[i][i] = 0

for i in range(1, H + 1):
    for j in range(1, W + 1):
        if S[i][j] == ".":
            p = (i - 1)*W + (j - 1)
            if S[i][j+1] == ".":
                d[p][p + 1] = 1
            if S[i][j-1] == ".":
                d[p][p - 1] = 1
            if S[i+1][j] == ".":
                d[p][p + W] = 1
            if S[i-1][j] == ".":
                d[p][p - W] = 1

for k in range(g):
    for i in range(g):
        for j in range(g):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

ans = 0

for i in range(g):
    for j in range(g):
        if d[i][j] != float("INF"):
            ans = max(ans, d[i][j])

print(ans)
### BUGGY CODE ###

def D():
    n = int(input())
    s = input()
    r, g, b = [], [], []
    for i in range(n):
        if s[i]=="R": r.append(i)
        elif s[i]=="G": g.append(i)
        else: b.append(i)
    ans = 0
    for i in r:
        for j in g:
            for k in b:
                if abs(i-j) != abs(k-j) and abs(i-k)!=abs(k-j) and abs(j-i)!=abs(k-i):
                    ans += 1
    print(ans)

D()

### FIXED CODE ###

def D():
    n = int(input())
    s = input()
    r,g,b = [],[],[]
    for i in range(n):
        if s[i]=="R": r.append(i)
        elif s[i]=="G": g.append(i)
        else: b.append(i)
    ans = len(r)*len(g)*len(b)
    for i in range(n):
        for j in range(i,n):
            if j + (j-i) >= n: continue
            if s[i]!=s[j] and s[i]!=s[2*j-i] and s[j]!=s[2*j-i]:
                ans -= 1
    print(ans)

D()
### BUGGY CODE ###

# -*- coding: utf-8 -*-

from math import factorial

x,y = map(int,input().split())
cnt = 0

for i in range(0,x//2+1):
    if 2*x-3*i == y:
        cnt += factorial(x-i)//(factorial(x-2*i)*factorial(i))
        break

print(cnt%(10**9+7))

### FIXED CODE ###

x,y = map(int,input().split())
ans = 0
mod = 10**9+7

if (x+y)%3 == 0:
    m = (2*y-x)//3
    n = (2*x-y)//3
    if m >= 0 and n >= 0:
        fac = [1]*(m+n+1)
        for i in range(2,m+n+1): 
            fac[i] = fac[i-1]*i % mod
        ans = fac[m+n]*(pow(fac[m],mod-2,mod)*pow(fac[n],mod-2,mod)%mod)%mod

print(ans)
### BUGGY CODE ###

N = int(input())
S = input()


def lcs(s1, s2):
    I = len(s1)
    J = len(s2)
    dp = [[0] * (J + 1) for _ in range(I + 1)]

    for i in range(I):
        for j in range(J):
            if s1[i] == s2[j]:
                dp[i + 1][j + 1] = dp[i][j] + 1
            else:
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])

    return dp[I][J]


ans = 0
for i in range(1, N):
    s1 = S[0:i]
    s2 = S[i:]
    ans = max(ans, lcs(s1, s2))

print(ans)


### FIXED CODE ###

def z_algo(S):
    N = len(S)

    A = [0] * N
    A[0] = N
    i = 1
    j = 0

    while i < N:
        while i + j < N and S[j] == S[i + j]:
            j += 1
        if not j:
            i += 1
            continue
        A[i] = j
        k = 1
        while N - i > k < j - A[k]:
            A[i + k] = A[k]
            k += 1
        i += k
        j -= k
    return A


N = int(input())
S = input()

ans = 0
for i in range(N):
    A = z_algo(S[i:])
    for idx, ls in enumerate(A):
        if idx - ls >= 0:
            ans = max(ans, ls)

print(ans)
### BUGGY CODE ###

n = int(input())
x = map(int, input().split())
a_list = list(x)

r_list = []
for i in range(n+1):
    r_list.append(a_list.count(i))

r_list2 = map(str, r_list[1:])
r_list2 = list(r_list2)

ans = "\n".join(r_list2)

print(ans)

### FIXED CODE ###

import collections
n = int(input())
x = map(int, input().split())
a_list = list(x)

# n = 5
# a_list = [1,1,3,3]

r_list = collections.Counter(a_list)
y = []
for i in range(1,(n+1)):
    if (i in r_list):
        y.append(r_list[i])
    else:
        y.append(0)

r_list2 = map(str, y)
r_list2 = list(r_list2)
ans = "\n".join(r_list2)
print(ans)

# r_list = map(a_list.count, range(n+1))
#r_list = list(r_list_v)
### BUGGY CODE ###

def resolve():
    N = int(input())
    A = [int(input()) for i in range(N)]

    mx = max(A)
    for i in range(N):
        s = A[i]
        if mx != s:
            print(mx)
        else:
            print(sorted(A)[-2])
            
resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    A = [int(input()) for i in range(N)]

    mx = max(A)
    sec = sorted(A)[-2]
    for i in range(N):
        s = A[i]
        if mx != s:
            print(mx)
        else:
            print(sec)

resolve()
### BUGGY CODE ###

def main(N, M, a_list):
    div = 10**9 + 7
    
    dp = {}
    dp[0] = 1
    if 1 in a_list:
        dp[1] = 0
    else:
        dp[1] = 1

    for i in range(N):
        if i+2 in a_list:
            dp[i+2] = 0
        else:
            dp[i+2] = (dp[i+1] + dp[i]) % div
    
    print(dp[N] % div)


if __name__ == "__main__":
    N, M = [int(x) for x in input().split()]
    a_list = []
    for _ in range(M):
        a_list.append(int(input()))

    main(N, M, a_list)


### FIXED CODE ###

def main(N, M, a_list):
    div = 10**9 + 7

    a_set = set(a_list)
    
    dp = {}
    dp[0] = 1
    if 1 in a_set:
        dp[1] = 0
    else:
        dp[1] = 1

    for i in range(N):
        if i+2 in a_set:
            dp[i+2] = 0
        else:
            dp[i+2] = (dp[i+1] + dp[i])
    
    print(dp[N] % div)


if __name__ == "__main__":
    N, M = [int(x) for x in input().split()]
    a_list = []
    for _ in range(M):
        a_list.append(int(input()))

    main(N, M, a_list)
### BUGGY CODE ###

n=int(input())
i=2
ans=[1]
while(i**2 <= n ):
  j=2
  while( i**(j+1) <=n ):
    j+=1
  ans.append( i**j)

print( max(ans) )
  

### FIXED CODE ###

n=int(input())
i=2
ans=[1]
while(i**2 <= n ):
  j=2
  while( i**(j+1) <=n ):
    j+=1
  ans.append( i**j)
  i+=1

print( max(ans) )
### BUGGY CODE ###

import math
n  = int(input())
 
ans = 1
for i in range(1, n+1):
  ans *= i
 
s = 10**9 + 7
 
print(ans % s)

### FIXED CODE ###

import math
n  = int(input())
 
ans = math.factorial(n)
 
s = 10**9 + 7
 
print(ans % s)
### BUGGY CODE ###

n,m = map(int,input().split())

p_list=[]
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if p not in p_list:
        if s == "WA":
            cnt[int(p)] += 1;
        if s == "AC":
            ans+=1
            plt+=cnt[int(p)]
            p_list.append(p)
        
print(str(ans) + " " + str(plt))



### FIXED CODE ###

n,m = map(int,input().split())

p_list=[0]*(n+1)
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if s == "WA":
        cnt[int(p)] += 1;
    if s == "AC":
        if p_list[int(p)] == 0:
                ans+=1
                plt+=cnt[int(p)]
                p_list[int(p)] += 1
        
print(str(ans) + " " + str(plt))