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

# AtCoder Beginner Contest 134 E - Sequence Decomposing

import sys

N = int(input())
ans = []

for n in range(N):
    now = int(sys.stdin.readline().strip())
    if ans:  # 最初の入力以外であり、すでに追加対象のリストが存在する
        if ans[0][-1] < now:
            ans[0].append(now)
        elif ans[-1][-1] >= now:
            appending = [now]
            ans.append(appending)
        else:
            # 二分探索で追加するリストの位置を特定する
            left = 0   # 追加できない
            right = len(ans) - 1

            while right - left > 1:
                mid = (right - left) // 2
                if ans[mid][-1] < now:
                    right = mid
                else:
                    left = mid
            ans[right].append(now)
    else:
        appending = [now]
        ans.append(appending)

    # for a in ans:
    #     if a[-1] < now:
    #         a.append(now)
    #         break
    # else:
    #     appending = [now]
    #     ans.append(appending)

print(len(ans))


### FIXED CODE ###

# AtCoder Beginner Contest 134 E - Sequence Decomposing

import sys
import bisect

N = int(input())
now = int(sys.stdin.readline().strip())
ans = [now]

for n in range(N - 1):
    now = int(sys.stdin.readline().strip())

    if now > ans[0]:
        ans[0] = now
    elif ans[-1] >= now:
        ans.append(now)
    else:
        # 2部探査で行進位置を探る
        left = 0  # 挿入不可能
        right = len(ans) - 1  # 挿入可能

        while right - left > 1:
            mid = (right + left) // 2
            if now > ans[mid]:
                right = mid
            else:
                left = mid

        ans[right] = now

print(len(ans))

    # if ans:  # 最初の入力以外であり、すでに追加対象のリストが存在する
    #     if ans[0][-1] < now:
    #         ans[0].append(now)
    #     elif ans[-1][-1] >= now:
    #         appending = [now]
    #         ans.append(appending)
    #     else:
    #         # 二分探索で追加するリストの位置を特定する
    #         left = 0   # 追加できない  ans[left][-1] > now
    #         right = len(ans) - 1  # ans[right][-1] < now
    #
    #         while right - left > 1:
    #             mid = (right - left) // 2
    #             if ans[mid][-1] < now:
    #                 right = mid
    #             else:
    #                 left = mid
    #         ans[right].append(now)
    # else:
    #     appending = [now]
    #     ans.append(appending)

    # for a in ans:
    #     if a[-1] < now:
    #         a.append(now)
    #         break
    # else:
    #     appending = [now]
    #     ans.append(appending)

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

#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  height, width = map(int, input().split())
  max_value = height * width
  values = []
  queue = []
  result = 0

  for y in range(height):
    values.append([0 if v == '#' else max_value for v in input().strip()])
    queue.extend((x, y, 1) for x, v in enumerate(values[-1]) if v == 0)

  while len(queue) > 0:
    x, y, v = queue.pop(0)
    result = v - 1

    if x > 0 and values[y][x - 1] > v:
      values[y][x - 1] = v
      queue.append((x - 1, y, v + 1))

    if x < width - 1 and values[y][x + 1] > v:
      values[y][x + 1] = v
      queue.append((x + 1, y, v + 1))

    if y > 0 and values[y - 1][x ] > v:
      values[y - 1][x] = v
      queue.append((x, y - 1, v + 1))

    if y < height - 1 and values[y + 1][x] > v:
      values[y + 1][x] = v
      queue.append((x, y + 1, v + 1))

  print(result, flush=True)


if __name__ == '__main__':
  main()



### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy


def main():
  height, width = map(int, input().split())
  max_value = height + width
  values = []

  for y in range(height):
    values.append([0 if v == '#' else max_value for v in input().strip()])

  values = numpy.array(values)

  for x in range(width - 1):
    values[:, x + 1] = numpy.minimum(values[:, x] + 1, values[:, x + 1])

  for x in range(width - 1, 0, -1):
    values[:, x - 1] = numpy.minimum(values[:, x] + 1, values[:, x - 1])

  for y in range(height - 1):
    values[y + 1, :] = numpy.minimum(values[y, :] + 1, values[y + 1, :])

  for y in range(height - 1, 0, -1):
    values[y - 1, :] = numpy.minimum(values[y, :] + 1, values[y - 1, :])

  print(numpy.max(values), flush=True)


if __name__ == '__main__':
  main()
### BUGGY CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))

sumh = sum(h)

if n <= k:
    print(0)
elif k == 0:
    print(sumh)
else:
    for i in range(k):
        sumh -= max(h)
        print(sumh)

### FIXED CODE ###

n,k = map(int,input().split())
h = list(sorted(map(int,input().split())))

ans = 0

for i in range(n-k):
    ans += h[i]
print(ans)
### BUGGY CODE ###

from itertools import *
from math import gcd

k = int(input())
if gcd(k, 10) == 1:
    i = 0
    while True:
        i += 1
        rep = (10 ** i // 9) * 7
        if rep % k == 0:
            print(i)
            break
else:
    print(-1)


### FIXED CODE ###

from itertools import *
from math import gcd

k = int(input())
if gcd(k, 10) == 1:
    i = 0
    r = 0
    while True:
        i += 1
        r = (10*r+7)%k
        if r == 0:
            print(i)
            break
else:
    print(-1)
### BUGGY CODE ###

import copy

def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.insert(0, 0)

	for i in range(1, n+1):
		ans = 0
		tmp = copy.deepcopy(a)
		del tmp[i]

		for j in range(len(tmp)-1):
			ans += abs(tmp[j+1] - tmp[j])
		ans += abs(tmp[-1])
		print(ans)


main()


### FIXED CODE ###

import copy

def calcAbs(a, i):
	return abs(a[i+1] - a[i-1]) - (abs(a[i] - a[i-1]) + abs(a[i+1] - a[i]))

def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.insert(0, 0)
	a.insert(len(a), 0)
	#a.append(0)

	total = 0
	for j in range(len(a)-1):
		total += abs(a[j+1] - a[j])

	for i in range(1, n+2-1):
		ans = total + calcAbs(a, i) 

		print(ans)


main()
### BUGGY CODE ###

import numpy as np
h,w=map(int,input().split())
a=[list(map(int,input().split())) for i in range(h)]
b=[list(map(int,input().split())) for i in range(h)]
d=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        d[i][j] = abs(a[i][j]-b[i][j])
dp=np.zeros((h,w,80*160),dtype=np.bool)
dp[0,0,d[0][0]] = True
for i in range(h):
    for j in range(w):
        for dis in range(80*160):
            if dp[i,j,dis]:
                if i+1<h:
                    dp[i+1,j,dis+d[i+1][j]]=True
                    dp[i+1,j,np.abs(dis-d[i+1][j])]=True
                if j+1<w:
                    dp[i,j+1,dis+d[i][j+1]]=True
                    dp[i,j+1,np.abs(dis-d[i][j+1])]=True
for dis in range(80*160):
    if dp[-1,-1,dis]:
        print(dis)
        break

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
h,w=map(int,input().split())
a=[list(map(int,input().split())) for i in range(h)]
b=[list(map(int,input().split())) for i in range(h)]
d=[[0 for i in range(w)] for j in range(h)]
maxd=1
for i in range(h):
    for j in range(w):
        d[i][j] = abs(a[i][j]-b[i][j])
        maxd=max(maxd,d[i][j])
dp=[[0 for j in range(w)] for k in range(h)]
c=20000
dp[0][0] |= 1 << c+d[0][0]
for i in range(h):
    for j in range(w):
        if i+1<h:
            dp[i+1][j] |= dp[i][j] << d[i+1][j]
            dp[i+1][j] |= dp[i][j] >> d[i+1][j]
        if j+1<w:
            dp[i][j+1] |= dp[i][j] << d[i][j+1]
            dp[i][j+1] |= dp[i][j] >> d[i][j+1]
m=1000000
cnt = 0
for x in bin(dp[h-1][w-1])[2:][::-1]:
    if x=='1':
        m=min(m,abs(cnt-c))
    cnt+=1
print(m)
### BUGGY CODE ###

import numpy as np
import fractions 
#from functools import reduce
import functools

MOD = 10**9+7


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

    x = 1
    ans = 0
    # for a in A:
    #     tmp = gcd(x, a)
    #     # ans += (i) * A[i] // tmp + A[i] * x //tmp  
    #     x = (x * a) // tmp

    def lcm(x, y):
        return x * y // fractions.gcd(x, y)
        
    
    x = functools.reduce(lcm, A, 1)
        
    b = 0
    for a in A:
        b += x // a
    print(b%MOD)
main()


### FIXED CODE ###

import fractions 
#from functools import reduce
import functools

MOD = 10**9+7


def main():
    # N = int(input())
    # A = list(map(int, input().split()))
    N, *A = map(int, open(0).read().split())
            
    x = 1
    for a in A:
        x *= a //  fractions.gcd(x, a)
        
    b = sum(x//a for a in A)
    print(b%MOD)
    
if __name__== "__main__":
    main()
### BUGGY CODE ###

S = list(map(str, input()))
Q = int(input())
for i in range(Q):
  Query = input().split()
  if Query[0] == '1':
    S.reverse()
  else:
    if Query[1] == '1':
      S = [Query[2]] + S
    else:
      S = S + [Query[2]]
print(''.join(S))

### FIXED CODE ###

from collections import deque
S = deque(input())
Q = int(input())
d = 0 # d=0:right, d=1:left
for i in range(Q):
  I = list(input().split())
  if I[0] == "1":
    d ^= 1
  else:
    if d + int(I[1]) == 2:
      S.append(I[2])
    else:
      S.appendleft(I[2])
if d == 1:
  S.reverse()
for s in S:
  print(s, end="")
print()
### BUGGY CODE ###

N = int(input())



L = []

for i in range(1,N):
  diff = N - i
  pair = sorted([i,diff])
  pair = set(pair)
  if len(pair) == 2 and pair not in L:
    L.append(pair)

print(len(L))


### FIXED CODE ###

N = int(input())

sup = int(N // 2) + 1

L = []

for i in range(1,sup):
  diff = N - i
  pair = [i,diff]
  pair = set(pair)
  if len(pair) == 2:
    L.append(pair)


    
print(len(L))
### BUGGY CODE ###

import itertools
s=int(input())
max_count=s//3
if max_count==0:
    print(0)
else:
    ans=0
    for i in range(1,max_count+1):
        data=[j for j in range(1,i+1)]
        amari=s-3*i
        ans+=len(list(itertools.combinations_with_replacement(data,amari)))
        ans%=10**9+7
    print(ans)

### FIXED CODE ###

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

s=int(input())
max_count=s//3
if max_count==0:
    print(0)
else:
    ans=0
    for i in range(1,max_count+1):
        data=[j for j in range(1,i+1)]
        amari=s-3*i
        ans+=cmb(i+amari-1,amari)
        ans%=10**9+7
    print(ans)
### BUGGY CODE ###

import sys

h, w, m = map(int, input().split())
row = [0]*h
col = [0]*w
bomb = []
for x in sys.stdin.readlines():
    H, W = map(int, x.split())
    bomb.append([H-1, W-1])
    row[H-1] += 1
    col[W-1] += 1

maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i in range(h):
    if row[i] == maxrow:
        p.append(i)
for i in range(w):
    if col[i] == maxcol:
        q.append(i)
for i in p:
    for j in q:
        if [i, j] not in bomb:
            print(ans + 1)
            exit()
print(ans)


### FIXED CODE ###

import sys

h, w, m = map(int, input().split())
row = [0]*h
col = [0]*w
bomb = set()
for x in range(m):
    H, W = map(int, input().split())
    bomb.add((H-1, W-1))
    row[H-1] += 1
    col[W-1] += 1

maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i in range(h):
    if row[i] == maxrow:
        p.append(i)
for i in range(w):
    if col[i] == maxcol:
        q.append(i)

for i in p:
    for j in q:
        if (i, j) not in bomb:
            print(ans + 1)
            exit()
print(ans)
### BUGGY CODE ###

import math
q=int(input())
lr=[list(map(int, input().split())) for i in range(q)]

l,r=[],[]
for a in lr:
    l.append(a[0])
    r.append(a[1])

ss = [i for i in range(1,max(r)+1)]
for i in range(2,int(math.sqrt(max(r)))+1):
    for j in range(2*i,max(r)+1,i):
        ss[j-1]=0
for j in range(q):
    ans=0
    for i in range(l[j],r[j]+1,2):
        if i in ss and (i+1)//2 in ss:
            ans+=1
    if l[j]==1:
        ans-=1
    print(ans)

### FIXED CODE ###

q=int(input())
lr=[list(map(int, input().split())) for i in range(q)]
l,r=[],[]
for a in lr:
    l.append(a[0])
    r.append(a[1])
mr=max(r)
x = [True]*(mr+1)
x[0]=False
x[1]=False

for i in range(mr+1):
    if x[i]:
        for j in range(2*i, mr+1, i):
            x[j] = False
c=[0]*(mr+1)
for i in range(1,mr+1):
    if x[i] and x[(i+1)//2]:
        c[i] = c[i-1]+1
    else:
        c[i] = c[i-1]
for i in range(q):
    print(c[r[i]]-c[l[i]-1])
### BUGGY CODE ###

def calc_E(prob):

    E = sum([i for i in range(1, prob+1)]) / prob
    return E

def main(N, K, list_p):
    
    max_E = 0

    for i in range(N-K+1):
        tmpE = 0
        for j in range(K):  tmpE += calc_E(list_p[i+j])
        if tmpE >= max_E :  max_E = tmpE
    
    return max_E
        


if __name__ == "__main__":

    [N, K] = list(map(int, input().split(' ')))
    list_p = list(map(int, input().split(' ')))

    answer = main(N, K, list_p)
    print(answer)

### FIXED CODE ###

def calc_E(prob):

    E = (prob + 1) / 2
    return E

def main(N, K, list_p):
    
    list_E = list(map(calc_E, list_p))
    max_E  = sum(list_E[0:K])
    prev_E = sum(list_E[0:K])

    for i in range(1, N-K+1):
        tmpE   = prev_E - list_E[i-1] + list_E[i-1+K]
        max_E  = max(max_E, tmpE)
        prev_E = tmpE

    return max_E
        


if __name__ == "__main__":

    [N, K] = list(map(int, input().split(' ')))
    list_p = list(map(int, input().split(' ')))

    answer = main(N, K, list_p)
    print(answer)
### BUGGY CODE ###

N,M = list(map(int,input().split()))
A = []
B = []
ans = 0
for _ in range(N):
    i = list(map(int,input().split()))
    A.append(i[0])
    B.append(i[1])
while M != 0:
    ind_ = A.index(min(A))
    if M - B[ind_] >= 0:
        M -= B[ind_]
        ans = ans + A[ind_]*B[ind_]
        B[ind_] -= B[ind_]
    else:
        ans = ans + A[ind_]*M
        M = 0
        B[ind_] = 0
    if B[ind_] <= 0:
        B.pop(ind_)
        A.pop(ind_)
print(ans)

### FIXED CODE ###

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

AB = [list(map(int,input().split())) for i in range(N)]
AB.sort()
ans = 0
for _ in range(N):
    if AB[_][1] >= M:
        ans += AB[_][0]*M
        break
    else:
        ans += AB[_][0]*AB[_][1]
        M -= AB[_][1]
print(ans)
### BUGGY CODE ###

n,m=map(int,input().split())
bridge=[0]*(n)
AB=[list(map(int,input().split())) for i in range(m)]
AB.sort(key=lambda x:x[1])
cnt=0
for i in range(m):
    p,q=AB[i]
    p-=1
    q-=1
    flag=0
    for j in range(p,q):
        if bridge[j]==1:
            flag=1
    if flag:
        continue
    else:
        bridge[q-1]=1
print(sum(bridge))

### FIXED CODE ###

n, m = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(m)]
AB.sort(key=lambda x: [x[1]])
migi = 0
cnt = 0
for i in range(m):
    a, b = AB[i]
    if migi <= a:
        cnt += 1
        migi = b

print(cnt)
### BUGGY CODE ###

#!/usr/bin/env python3
MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
o = [[0] * (n + 1) for _ in range(100)]
x = [[0] * (n + 1) for _ in range(100)]
for b in range(100):
    for i in range(n):
        o[b][i + 1] += o[b][i]
        x[b][i + 1] += x[b][i]
        if a[i] >> b & 1 == 1:
            o[b][i + 1] += 1
        else:
            x[b][i + 1] += 1
li = []
nxt = 0
for b in range(100):
    c = 0
    for i in range(n):
        if a[i] >> b & 1 == 1:
            c += x[b][i]
        else:
            c += o[b][i]
    li.append((nxt + c) % 2)
    nxt = (nxt + c) // 2
ans = 0
for b in range(100)[::-1]:
    ans *= 2
    ans += li[b]
    ans %= MOD
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
ans = 0
for b in range(60)[::-1]:
    ans <<= 1
    c = sum(a[i] >> b & 1 for i in range(n))
    ans = (ans + c * (n - c)) % MOD
print(ans)
### BUGGY CODE ###

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

ans = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if (x+y+z) == s:
                ans+=1
print(ans)


### FIXED CODE ###

k, s = map(int, input().split())
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)
### BUGGY CODE ###

S = raw_input()
while True:
    new_S = S.replace('ST', '')
    if len(S) == len(new_S):
        break
    S = new_S
print len(S)


### FIXED CODE ###

S = raw_input()
left = 0
ans = 0
for s in S:
    if s == 'S':
        left += 1
    elif s == 'T' and left > 0:
        left -= 1
        ans += 2
print len(S) - ans
### BUGGY CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N, M = lr()
    rev = 0
    if N < M:
        M, N = N, M
        rev = 1
    T = np.zeros(1, dtype=np.int8)
    for i in range(N):
        T = np.tile(T, (2, 2))
        T[1<<i:, 1<<i:] ^= 1
    T = np.diff(T, axis=0)
    T = np.diff(T, axis=1)
    T = T[:, :(1<<M)-1]%2
    if rev:
        T = np.transpose(T)
    for i in range(len(T)):
        print(*T[i], sep='')
resolve()

### FIXED CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N, M = lr()
    rev = 0
    if N < M:
        M, N = N, M
        rev = 1
    T = np.zeros(1, dtype=np.int8)
    for i in range(N):
        T = np.tile(T, (2, 2))
        T[1<<i:, 1<<i:] ^= 1
    T = np.diff(T, axis=0)
    T = np.diff(T, axis=1)
    T = T[:, :(1<<M)-1]%2
    if rev:
        T = np.transpose(T)
    for t in T:
        print(''.join(t.astype(str)))
resolve()
### BUGGY CODE ###

N = input()
d = {}
for _ in range(N):
    a = input()
    if str(a) not in d.keys():
        d[str(a)] = 1
    else:
        d[str(a)] ^= 1

print sum(d.values())

### FIXED CODE ###

N = input()
d = {}
for _ in range(N):
    a = input()
    d[str(a)] = d.get(str(a), 0)
    d[str(a)] ^= 1

print sum(d.values())
### BUGGY CODE ###

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

ope = []
for i in range(M):
    ope.append(tuple(map(int, input().split())))

ope.sort(key=lambda x: x[1], reverse=True)

cnt = 0
for b, c in ope:
    A = A + [c] * b
    cnt += b

    if cnt > N:
        break

A.sort(reverse=True)

print(sum(A[:N]))


### FIXED CODE ###

import sys


N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

ope = [list(map(int, x.split())) for x in sys.stdin.readlines()]

ope.sort(key=lambda x: -x[1])

mp = 0
ap = 0
cnt = 0
ans = 0

while cnt < N:
    a = A[ap]
    m = ope[mp][1] if mp < M else 0

    if m >= a:
        mc = min(ope[mp][0], N - cnt)
        ans += m * mc
        cnt += mc
        mp += 1
    else:
        ans += a
        cnt += 1
        ap += 1

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

N,M,L = map(int, input().split())
INF = float("inf")
# 初期化
d = [[INF]*N for i in range(N)]
for i in range(N):
    d[i][i] = 0
for i in range(M):
    a,b,c = map(int, input().split())
    a -= 1
    b -= 1
    # 多重辺の場合はMIN
    d[a][b] = c
    d[b][a] = c
# 最適化(わーしゃゆふよいど)
for k in range(N):
    for i in range(N):
        # 左右は対称だろう
        for j in range(i+1,N):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])
            d[j][i] = d[i][j]

# 初期化2
d2 = [[INF]*N for i in range(N)]
for i in range(N):
    d2[i][i] = 0
for i in range(N):
    for j in range(N):
        # 給油できるところに辺を張る
        if d[i][j] <= L:
            d2[i][j] = 1
for k in range(N):
    for i in range(N):
        for j in range(i+1,N):
            d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j])
            d2[j][i] = d2[i][j]
            

#query
Q = int(input())
for i in range(Q):
    l  = list(map(int, input().split()))
    s = min(l)-1
    t = max(l)-1
    
    ans = d2[s][t]-1
    if ans == INF:
        ans = -1
    print(ans)

### FIXED CODE ###

N,M,L = map(int, input().split())
INF = 10**18
# 初期化
d = [[INF]*N for i in range(N)]
for i in range(N):
    d[i][i] = 0
for i in range(M):
    a,b,c = map(int, input().split())
    a -= 1
    b -= 1
    # 多重辺の場合はMIN
    d[a][b] = c
    d[b][a] = c
# 最適化(わーしゃゆふよいど)
for k in range(N):
    for i in range(N):
        # 左右は対称だろう
        for j in range(i+1,N):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])
            d[j][i] = d[i][j]

# 初期化2
d2 = [[INF]*N for i in range(N)]
for i in range(N):
    d2[i][i] = 0
for i in range(N):
    for j in range(N):
        # 給油できるところに辺を張る
        if d[i][j] <= L:
            d2[i][j] = 1
for k in range(N):
    for i in range(N):
        for j in range(i+1,N):
            d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j])
            d2[j][i] = d2[i][j]
            

#query
Q = int(input())
for i in range(Q):
    l  = list(map(int, input().split()))
    s = min(l)-1
    t = max(l)-1
    
    ans = d2[s][t]
    if ans == INF:
        ans = 0
    print(ans-1)
### BUGGY CODE ###

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

ans = [0] * (N+1)

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

for a in ans[1:]:
    print(a)

### FIXED CODE ###

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

ans = [0] * (N+1)

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

for a in ans[1:]:
    print(a)
### BUGGY CODE ###

import math

N = int(input())

A = [0]*10001
for i in range(10001):
    A[i] = math.floor(math.sqrt(i))

n,nn,nnn,nnnn = 0,0,0,0
for n in range(1,N+1):
    ans = 0
    for x in range(1,A[n]+1):
        nn = n - x * x
        for y in range(1,A[nn]+1):
            nnn = nn - y * y - y * x
            if nnn <= 0:
                break
            for z in range(1,A[nnn]+1):
                nnnn = nnn - z * z - z * x - z * y
                if nnnn < 0:
                    break
                elif nnnn == 0:
                    ans += 1
                    break
    print(ans)

### FIXED CODE ###

import math
from collections import defaultdict

N = int(input())
D = defaultdict(int)

NN = math.floor(math.sqrt(N))
for x in range(1,NN+1):
    for y in range(1,NN+1):
        for z in range(1,NN+1):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if a <= N:
                D[a] += 1

for i in range(1,N+1):
    print(D[i])
### BUGGY CODE ###

def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    k = True
    for i in range(1, N):
        if H[i] >= max(H[:i]):
            if H[i] - 1 >= H[i - 1]:
                H[i] = H[i] - 1
        else:
            k = False
            break
    if k:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    k = True
    for i in range(1, N):
        if H[i] >= H[i-1]:
            if H[i] - 1 >= H[i - 1]:
                H[i] = H[i] - 1
        else:
            k = False
            break
    if k:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
### BUGGY CODE ###

n=int(input())

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

  
ans=0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            
            ans+=gcd(a,b,c)  
print(ans)


### FIXED CODE ###

n=int(input())
 
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
  
ans=0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            
            ans+=gcd(a,b,c)  
print(ans)