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

import heapq
import copy
  
N = int(input())
ab = [[] * (N + 1) for i in range(N + 1)]
E = [0] * (N - 1)
for i in range(N - 1):
  a, b = map(int, input().split())
  ab[a].append(b)
  ab[b].append(a)
  E[i] = [a, b]
#print(ab)

#xとyを根とする部分木の頂点の数を求める
#辺xy を切り離して考える
def dfs(x, y):
  q = copy.deepcopy(ab[x])
  count = 1
  visited = [0] * (N + 1)
  visited[x] = 1
  #print(q, visited)
  while q:
    now = heapq.heappop(q)
    visited[now] = 1
    #if x == 3:
    #  print(q, now, visited)
    #  print(ab)
    if now != y:
      count += 1
      for i in range(len(ab[now])):
        if visited[ab[now][i]] == 0:
          heapq.heappush(q, ab[now][i])
  return count

#print(dfs(2, 3))
#(1 - (1/ 2) ** c) * (1 - (1/ 2) ** (N - c)) + 1
#上式を辺ごとに全て足し合わせたものがSの頂点の個数の期待値
#そこからN / 2を引けば求める期待値
#逆元を考える必要があるため、分母と分子に分けて考える

t = 2 ** N#分母
s = 0#分子
for i in range(N - 1):
  c = dfs(E[i][0], E[i][1])
  #print(c)
  s += (2 ** N + 1 - 2 ** (N - c) - 2 ** c) 
  
#辺の個数を数えたので、それに2 ** Nを足して、頂点の個数にする
#-1は空グラフをケア
s += 2 ** N - 1  
s -= N * 2 ** (N - 1)

#逆元計算
p = 10 ** 9 + 7
t_inv = pow(t, p-2, p)
ans = t_inv * s % p
print(ans)
  
    
    
    
    
    
    
  
  

### FIXED CODE ###

#解説方針#解法1
#https://qiita.com/ZhangChaoran/items/71fab0e4b8647a93d3a0
from collections import deque
from heapq import heappop, heappush
#標準入力
N = int(input())
MOD = 10 ** 9 + 7
L = [[] for i in range(N + 1)] #dfs用
for i in range(N - 1):
  a, b = map(int, input().split())
  L[a].append(b)
  L[b].append(a)

#木の探索
parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
    x = stack.pop()
    order.append(x)  # 行きがけ順探索リスト
    for y in L[x]:
        if y == parent[x]:
            continue
        parent[y] = x  # 親ノードを記録
        stack.append(y)
#print(order, parent)

half = pow(2, MOD - 2, MOD)
power_inv = [1] * (N + 1)#2 ** N の逆元の集合
size = [1] * (N + 1)
for i, v in enumerate(order[::-1], 1):#iが1から
    p = parent[v]
    x = size[v]  # vの子孫ノード数（自分も含む）をとる
    size[p] += x  # 親にノード数を加算
    power_inv[i] = power_inv[i - 1] * half % MOD  # [1, 1/2, 1/4, ...]
#print(size)
# 辺iがSに含まれるための必要十分条件による辺の個数の期待値 
# (1 - (1/2) ** i)(1 - (1/2) ** (N - i))を展開して計算
# 根である1の頂点以外は、ある頂点とその親を結ぶ辺を考えた際
# i と N - i個の頂点に別れるので,size[2:]でOK
ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) %
          MOD for i in size[2:])  
#ans = sum((1 - (1/2) ** i- (1/2) ** (N - i) + (1/2) ** N) for i in size[2:])  
#print(ans)
ans += 1  # 木の頂点の個数は辺の個数+1
# -「すべての辺が含まれない、つまり空グラフの場合の誤加算」-N/2
ans -= power_inv[N] + N * power_inv[1]  
#ans -= N * power_inv[1]  
ans %= MOD

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

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    C=Counter(a)
    C[a[i]]-=1
    #print(C)
    ans=0
    for k,v in C.items():
        if v>=2:
            ans+=v*(v-1)//2
    print(ans)

### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
C=Counter(a)
#print(C)
total=0
for k,v in C.items():
    if v>=2:
        total+=v*(v-1)//2
#print(total)
for i in range(n):
    V=C[a[i]]
    ans=total-(V*(V-1))//2+((V-1)*(V-2))//2
    print(ans)
### BUGGY CODE ###

from collections import deque
N, M = map(int, input().split())
C = {}
for _ in range(N):
    A,B = map(int, input().split())
    if A in C:
        C[A].append(B)
    else:
        C[A] = []
        C[A].append(B)
for i in C:
    C[i] = deque(sorted(C[i])[::-1])

answer = 0
tmp = deque()

for i in range(1, M+1):
    if i in C:
        tmp2 = tmp
        tmp = deque()
        right = C[i]
        while len(tmp2) != 0 and len(right) != 0:   # line7
            if tmp2[0] > right[0]:                  # line8
                tmp.append(tmp2.popleft())           # line9
            else:                                   # line10
                tmp.append(right.popleft())          # line11
        if len(tmp2) != 0:                          # line12
            tmp+=tmp2                      # line13
        else:                       # line14
            tmp+=right
    if tmp != deque():
        answer += tmp[0]
        tmp.popleft()
print(answer)

### FIXED CODE ###

import heapq
N, M = map(int, input().split())
C = {}
for _ in range(N):
    A,B = map(int, input().split())
    if A in C:
        C[A].append(B)
    else:
        C[A] = []
        C[A].append(B)
for i in C:
    C[i] = sorted(C[i])[::-1]

answer = 0
tmp = []
heapq.heapify(tmp)

for i in range(M+1):
    if i in C:
        right = C[i]
        for j in right:
            heapq.heappush(tmp,-1*j)
        
    if tmp != []:
        answer += -1*heapq.heappop(tmp)
print(answer)
### BUGGY CODE ###

s='0'
s+=input()
n=len(s)
inf=float('inf')
dp=[[inf]*2 for _ in range(n+1)]
dp[0][0]=0
for i in range(n):
  for j in range(2):
    si=int(s[-i-1])
    si+=j
    for a in range(10):
      ni=i+1
      nj=0
      b=a-si
      if b<0:
        nj=1
        b+=10
      dp[ni][nj]=min(dp[ni][nj],dp[i][j]+a+b)
print(dp[n][0])

### FIXED CODE ###

s='0'
s+=input()
n=len(s)
inf=float('inf')
dp=[[inf]*2 for _ in range(n+1)]
dp[0][0]=0
for i in range(n):
  for j in range(2):
    si=int(s[-i-1])
    si+=j
    for a in range(10):
      ni=i+1
      nj=0
      b=a-si
      if b<0:
        nj=1
        b+=10
      dp[ni][nj]=min(dp[ni][nj],dp[i][j]+a+b)
print(dp[n][0])
### BUGGY CODE ###

# coding: utf-8

if __name__ == "__main__":
    N = int(input())
    s = []
    for i in range(N):
        s.append("".join(sorted(input())))
    ans = 0
    for i in range(len(s)):
        for j in range(i+1, len(s)):
            if s[i] == s[j]:
                ans += 1
    print(ans)

### FIXED CODE ###

# coding: utf-8

def fact(n, m):
    ans = 1
    for i in range(n-m+1, n+1):
        ans *= i
    return ans

if __name__ == "__main__":
    N = int(input())
    s = []
    c = {}
    for i in range(N):
        a = "".join(sorted(input()))
        s.append(a)
        try:
            c[a] += 1
        except KeyError:
            c[a] = 1
    
    ans = 0
    for k,v in c.items():
        ans += fact(v,2)/2
    
    print(int(ans))
### BUGGY CODE ###

from itertools import combinations
n=int(input())
s=input()
ans=0
set_s=len({i for i in s})
for i in range(1,set_s+1):
    koho=[j for j in tuple(combinations(s,i)) if len(j)==len(tuple(set(j)))]
    ans+=len(koho)
print(ans%(10**9+7))

### FIXED CODE ###

from collections import Counter
n=int(input())
s=input()
cnt=Counter(s)
ans=1
for i in cnt.values():
    ans*=i+1
print((ans-1)%(10**9+7))
### BUGGY CODE ###

S = input()
Q = int(input())
reverse_index = -1

for i in range(Q):
    query = input()
    if query[0] == '1':
        reverse_index *= -1
    elif query[0] == '2':
        if query[2] == '1':
            if reverse_index == -1:
                S = query[4] + S
            else:
                S = S + query[4]
        else:
            if reverse_index == -1:
                S = S + query[4]
            else:
                S = query[4] + S

if reverse_index == 1:
    print(S[::-1])
else:
    print(S)


### FIXED CODE ###

from collections import deque

S = deque(input())
Q = int(input())
reverse_index = -1

for i in range(Q):
    query = input()
    if query[0] == '1':
        reverse_index *= -1
    elif query[0] == '2':
        if query[2] == '1':
            if reverse_index == -1:
                S.appendleft(query[4])
            else:
                S.append(query[4])
        else:
            if reverse_index == -1:
                S.append(query[4])
            else:
                S.appendleft(query[4])

if reverse_index == 1:
    S.reverse()
    print(*S, sep='')
else:
    print(*S, sep='')
### BUGGY CODE ###

import sys
input = sys.stdin.readline

h,w = map(int,input().split())
c = []
for i in range(h):
  a = input()
  c.append(a)
  
from collections import deque

d = [[10**4] * w for i in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

que = deque([])
for i in range(h):
  for j in range(w):
    if c[i][j] == '#':
      que.append((i,j,0))
      d[i][j] = 0

ans = 0
while que:
  p = que.popleft()
  for i in range(4):
      nw = p[1] + dx[i]
      nh = p[0] + dy[i]
      if 0 <= nw < w and 0 <= nh < h and p[2] < d[nh][nw]:
          que.append((nh,nw,p[2]+1))
          d[nh][nw] = p[2]+1
          ans = max(ans,p[2]+1)

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

h,w = map(int,input().split())
c = []
for i in range(h):
  a = input()
  c.append(a)
  
from collections import deque

d = [[-1] * w for i in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

que = deque([])
for i in range(h):
  for j in range(w):
    if c[i][j] == '#':
      que.append((i,j,0))
      d[i][j] = 0

ans = 0
while que:
  p = que.popleft()
  for i in range(4):
      nw = p[1] + dx[i]
      nh = p[0] + dy[i]
      if 0 <= nw < w and 0 <= nh < h and d[nh][nw]==-1:
          que.append((nh,nw,p[2]+1))
          d[nh][nw] = p[2]+1
          ans = max(ans,p[2]+1)

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

n,k,q = map(int,input().split())
lst = [int(input()) for _ in range(q)]
for i in range(1,n+1):
    score = k-q+lst.count(i)
    print("Yes" if score > 0 else "No")
    

### FIXED CODE ###

n,k,q = map(int,input().split())
lst = [int(input()) for _ in range(q)]
score = [k-q]* n
for i in range(q):
    score[lst[i]-1] +=1
for k in range(n):
    print("Yes" if score[k] >0 else "No")
### BUGGY CODE ###

A, B, C = map(int, input().split())
K = int(input())

while K > 0:
    if B < A:
        B *= 2
        K -= 1
    elif C < B:
        C *= 2
        K -= 1
    
    if B > A and C > B:
        break

if B > A and C > B:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A, B, C = map(int, input().split())
K = int(input())

for i in range(K):
    if B <= A:
        B *= 2
    elif C <= B:
        C *= 2

if B > A and C > B:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

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

ans = 0
B = []
for a in A:
    if len(B)==0:
        ans += 0
        B.append(a)
    elif len(B)==1:
        ans += B[0]
        B.append(a)
    else:
        max_ = min(B[0],B[-1])
        idx = len(B)-1
        for i in range(len(B)-1):
            if min(B[i],B[i+1]) > max_:
                max_ = min(B[i],B[i+1])
                idx = i
        ans += max_
        B = B[:idx] + [a] + B[idx:]

print(ans)

### FIXED CODE ###

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

ans = 0
idx = 0
cnt = 1
for a in range(N-1):
    ans += A[idx]
    cnt += 1
    if cnt == 2:
        idx += 1
        cnt = 0

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

n, k =map(int, input().split())
h = list(map(int, input().split()))
dp = [10 ** 9 for _ in range(n)]
dp[0] = 0
for i in range(1, n):
    for j in range(1, min(i+1, k+1)):
        x = dp[i-j] + abs(h[i]-h[i-j])
        #print([i, j, x])
        dp[i] = min(x, dp[i])
    #print(dp[i])
print(dp[n-1])

### FIXED CODE ###

n, k =map(int, input().split())
h = list(map(int, input().split()))
dp = [10 ** 9 for _ in range(n)]
dp[0] = 0
for i in range(1, n):
    for j in range(1, min(i+1, k+1)):
        x = dp[i-j] + abs(h[i]-h[i-j])
        #print([i, j, x])
        dp[i] = min(x, dp[i])
    #print(dp[i])
print(dp[n-1])
### BUGGY CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc126_d


class Graph():

    def __init__(self):
        self.adjacency_dict = {}
    
    def add_vertex(self, v):
        self.adjacency_dict[v] = []

    def add_edge(self, v1, v2):
        self.adjacency_dict[v1].append(v2)
        self.adjacency_dict[v2].append(v1)

    def get_vertexes(self):
        return self.adjacency_dict.keys()

    def get_edges(self, v):
        return self.adjacency_dict[v]

    def print_graph(self):
        print(self.adjacency_dict)

n = int(input())
p = [[] for _ in range(n)]
for i in range(n):
    for _ in range(n):
        p[i].append(0)

res = []
g = Graph()
for i in range(n):
    res.append(-1)
    g.add_vertex(i)

for i in range(n-1):
    u, v, w = map(int, input().strip().split())
    g.add_edge(u-1, v-1)
    p[u-1][v-1] = w % 2
    p[v-1][u-1] = w % 2

q = []
res[0] = 0
q.append(0)
while(len(q) > 0):
    v = q.pop()
    for u in g.get_edges(v):
        if res[u] != -1:
            continue
        w = p[u][v]
        res[u] = (res[v] + w) % 2
        q.append(u)

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


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc126_d


class Graph():

    def __init__(self):
        self.adjacency_dict = {}
        self.weight = []
    
    def add_vertex(self, v):
        self.adjacency_dict[v] = []
        self.weight.append([])

    def add_edge(self, v1, v2, w):
        self.adjacency_dict[v1].append(v2)
        self.adjacency_dict[v2].append(v1)
        self.weight[v1].append(w)
        self.weight[v2].append(w)

    def get_vertexes(self):
        return self.adjacency_dict.keys()

    def get_edges(self, v):
        return self.adjacency_dict[v], self.weight[v]

    def print_graph(self):
        print(self.adjacency_dict)

n = int(input())

res = []
g = Graph()
for i in range(n):
    res.append(-1)
    g.add_vertex(i)

for i in range(n-1):
    u, v, w = map(int, input().strip().split())
    g.add_edge(u-1, v-1, w % 2)

q = []
res[0] = 0
q.append(0)
while(len(q) > 0):
    v = q.pop()
    u_l, w_l = g.get_edges(v)
    for u, w in zip(u_l, w_l):
        if res[u] != -1:
            continue
        res[u] = (res[v] + w) % 2
        q.append(u)

for i in range(n):
    print(res[i])
### BUGGY CODE ###

N, K = map(int, input().split())
A = [int(i) for i in input().split()]
i_list = [0] * N

A_sum = A[0]
for i in range(K-1):
    if A[i+1] == 0:
        A_sum = 0
        break
    else:
        A_sum = A_sum * A[i+1]
i_list[K-1] = A_sum
cnt = 0

for k in range(K, N):
    i_list[k] = i_list[k-1] // A[cnt] * A[k]
    cnt = cnt + 1

for k in range(K-1, N-1):
    if i_list[k] < i_list[k+1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

N, K = map(int, input().split())
A = [int(i) for i in input().split()]
i_list = [0] * N

for i in range(K, N):
    if A[i-K] < A[i]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

R, G, B, N = map(int, input().split())
ans = 0

for r in range(N//R+1):
  if R * r > N: continue
  for g in range((N-r*R)//G+1):
    if R*r + G*g > N: break
    if (N - R*r - G*g) % B == 0:
      ans += 1
print(ans)

### FIXED CODE ###

R, G, B, N = map(int, input().split())
ans = 0

a = max(R, G, B)
if a == R:
  b = max(G, B)
elif a == G:
  b = max(B, R)
else:
  b = max(R, G)
c = min(R, G, B)
for i in range(N//a+1):
  for j in range((N-a*i)//b+1):
    if ((N-a*i)-b*j)%c == 0:
      ans += 1
print(ans)
### BUGGY CODE ###

from fractions import gcd


def main():

    N = int(input())
    A = list(map(int, input().split()))
    MOD = 10**9 + 7

    lcm = 1
    for a in A:
        lcm = lcm * a // gcd(lcm, a)


    ans = 0
    for a in A:
        ans += lcm // a

    print(ans % MOD)    

if __name__ == "__main__":
    main()

### FIXED CODE ###

from fractions import gcd


def main():
        
    N = int(input())
    A = list(map(int, input().split())) 
    MOD = 10**9 + 7


    l = 1

    for a in A:
        l = l * a // gcd(l, a)


    ans = 0
    for a in A:
        ans += (l // a)
    ans %= MOD

    print(ans)


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

import sys
n,k = map(int,input().split())
l = []
a = abs(n-k)
b = abs(a-k)
if n < a:
    print(n)
    sys.exit()
else:
    for i in range(10**100):
        l.append(a)
        l.append(b)
        if l[i]<l[i+1]:
            print(l[i])

### FIXED CODE ###

n, k = map(int, input().split()) 
t = n % k
if (k-t > t):
    print(t)
else:
    print(k-t)
### BUGGY CODE ###

d1 = int(input())
d = input().split()
d2 = [int(x) for x in d]
count=0
for n in range(d1):

    for m in range(d1):
        if d2[n] == d2[m]:
            if n != m:
                count+=1


if count==0:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

N = int(input())
A = map(int, input().split())
if N == len(set(A)):
    print('YES')
else:
    print('NO')
### BUGGY CODE ###

from collections import deque
from copy import deepcopy

N=int(input())
a=[0]*(N-1)
b=[0]*(N-1)
c=[set() for _ in range(N)]
d=[set() for _ in range(N)] # 隣接リスト
e=[-1 for _ in range(N)] #訪問ずみかどうか
di=dict()

for i in range(N-1):
    a[i],b[i] = map(int,input().split())
    d[a[i]-1].add(b[i]-1)
    d[b[i]-1].add(a[i]-1)
f=deepcopy(d)

v=deque([0])
e[0]=0

maxi=0
while len(v)>0:
  k=v.popleft()
  maxi=max(maxi,len(d[k]))
  all=set(i+1 for i in range(len(d[k])))
  pos=deepcopy(all)
  pos -= c[k]
  for item in d[k]:
    if e[item]==-1:
      s=min(pos)
      c[k].add(s)
      c[item].add(s)
      pos.remove(s)
      e[item] = e[k]+1
      v.append(item)
      st=str(k)+","+str(item)
      di[st] = s
      
print(maxi)
for i in range(N-1):
  t_str = str(a[i]-1)+","+str(b[i]-1)
  print(di[t_str])

### FIXED CODE ###

from collections import deque

N=int(input())
a=[0]*(N-1)
b=[0]*(N-1)
c=[set() for _ in range(N)] # 使用している色
d=[set() for _ in range(N)] # 隣接リスト
e=[ False for _ in range(N)] #訪問ずみかどうか
f=[0]*N  #答え
for i in range(N-1):
    a[i],b[i] = map(int,input().split())
    d[a[i]-1].add(b[i]-1)
    d[b[i]-1].add(a[i]-1)

maxi=max([len(d[i]) for i in range(N-1)])
print(maxi)
#print("c:",c)
#print("d",d)
#print("e",e)

#x=0としてBFSする

v=deque([0])
e[0]=True
color=1

while v:
  p = v.popleft()
  for q in d[p]:
    if e[q]==False:
      while color in c[p]:
        color +=1
        if color>maxi:
          color=1
      c[p].add(color)
      c[q].add(color)
      f[q]=color
      e[q]=True
      v.append(q)
      
for i in range(N-1):
  print( f[b[i]-1])
### BUGGY CODE ###

tl=200100

ft=[0]*tl

def upd(i):
	global ft
	i+=1
	while(i<tl):
		ft[i]+=1
		i+=i&-i

def get(i):
	global ft
	i+=1
	ret=0
	while(i!=0):
	    ret+=ft[i]
	    i-=i&-i
	return ret

md = 998244353
n = int(input())
cy = [[0] * 4 for _ in range(n)]
xy = [[0]*2 for _ in range(n)]
yxi = [[0]*3 for _ in range(n)]
ys = []
hp = []
for i in range(n):
	xy[i] = [int(item) for item in input().split()]
xy.sort()

for i in range(n):
	yxi[i]=[xy[i][1],xy[i][0],i]
yxi.sort()

cnt=[0]*(n+1)
cnt[0]=1
for i in range(1,n+1):
	cnt[i]=cnt[i-1]*2%md

def comb(x):
	return cnt[x]-1;

ans=0

for i in range(n):
	ix=yxi[i][2]
	a=get(ix)
	b=get(n)-get(ix)
	c=ix-a
	d=n-ix-1-b
	exc=(comb(a+b)+comb(a+c)+comb(b+d)+comb(c+d)-comb(a)-comb(b)-comb(c)-comb(d))%md
	cur=(comb(n)-exc)%md
	ans=(ans+cur)%md
	upd(ix)

if(ans<0):ans+=md

print(ans)


### FIXED CODE ###

import sys
import array

from operator import itemgetter

def main():



	input = sys.stdin.readline


	md = 998244353
	n = int(input())
	tl=n+1
	
	ft=[0]*tl

	xy = [[0]*2 for _ in range(n)]
	for i in range(n):
		xy[i] = [int(item) for item in input().split()]
	xy.sort(key=itemgetter(0))
	yxi = [y for x, y in xy]

	*YS, = set(yxi)
	YS.sort()
	yxi= list(map({e: i for i, e in enumerate(YS)}.__getitem__, yxi))

	ct=[0]*(n+1)
	ct[0]=1
	for i in range(1,n+1):
		ct[i]=ct[i-1]*2%md

	cnt=tuple(ct)

	def upd(i):
		i+=1
		while(i<=n):
			ft[i]+=1
			i+=i&-i

	def get(i):
		i+=1
		ret=0
		while(i!=0):
		    ret+=ft[i]
		    i-=i&-i
		return ret

	def calc(get,upd):
		for i, y in enumerate(yxi):
			v = get(y); upd(y)
			p1 = cnt[v]; p0 = cnt[y - v]
			q1 = cnt[i - v]; q0 = cnt[(n - y - 1) - (i - v)]
			yield (p0 + p1 + q0 + q1 - (p0 + q1) * (p1 + q0)) % md


	print((sum(calc(get,upd))+n*cnt[n] - n)%md)

main()
### BUGGY CODE ###

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

for i in range(N):
  List.append(A.index(i+1)+1)
  L = [str(i) for i in List]

L = ' '.join(L)
print(L)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
List = [0]*N


for i, a in enumerate(A):
  List[int(a)-1] = str(i+1)

  
print(" ".join(List))
### BUGGY CODE ###

n = int(input())
l = [input() for _ in [0]*n]
ll = list(l)
for x in l:
    if ll.count(x) != 1:
        ll.remove(x)
print(len(ll))


### FIXED CODE ###

n = int(input())
l = []
l_a = l.append
for _ in range(n):
    l_a(input())
print(len(set(l)))
### BUGGY CODE ###

from functools import reduce

# 入力
N, Q = map(int, input().split())
s = input()
t, d = zip(*(input().split() for _ in range(Q)))


# めぐる式二分法
def bis(p, ok=-1, ng=10**18):
    mid = (ok + ng) // 2
    return (
        ok if abs(ok - ng) == 1 else
        bis(p, mid, ng) if p(mid) else
        bis(p, ok, mid)
    )


# Q回の呪文詠唱後、マスiにいたゴーレムが移動したマス。ただし、
# 0の場合、マス1から左に移動しようとして消滅したことを、
# N + 1の場合、マスNから右に移動しようとして消滅したことを表す。
def f(i):
    return reduce(
        lambda j, q: (
            0 if j == 0 else
            j - 1 if 1 <= j <= N and s[j - 1] == q[0] and q[1] == 'L' else
            j if 1 <= j <= N and s[j - 1] != q[0] else
            j + 1 if 1 <= j <= N and s[j - 1] == q[0] and q[1] == 'R' else
            N + 1
        ),
        zip(t, d),
        i
    )


# 二分法により、マス1から左に移動しようとして消滅したゴーレムの数と
# マスNから右に移動しようとして消滅したゴーレムの数の和を求める
ans = (
    bis(lambda i: f(i) == N + 1, ok=N + 1, ng=0) -
    bis(lambda i: f(i) == 0, ok=0, ng=N + 1) -
    1
)
print(ans)


### FIXED CODE ###

N, Q = map(int, input().split())
s = input()
t, d = zip(*(input().split() for _ in range(Q)))


def f(i):
    i -= 1
    if i < 0:
        return -1
    if i >= N:
        return 1
    for j in range(Q):
        if s[i] == t[j]:
            i += 1 if d[j] == 'R' else -1
        if i < 0:
            return -1
        elif i >= N:
            return 1
    return 0


h, l = N + 1, 1
while h > l:
    i = (h + l) // 2
    r = f(i)
    if r == 1:
        h = i
    else:
        l = i + 1

ans = N - h + 1

h, l = N, 0
while h > l:
    i = (h + l + 1) // 2
    r = f(i)
    if r == -1:
        l = i
    else:
        h = i - 1

ans = N - ans - l

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

N = int(input())
a = tuple(map(int, input().split()))
for k in range(N):
  c = 0
  A = list(a)
  del A[k]
  while len(A) > 0:
    y = A.count(A[0])
    c += y*(y-1)//2
    x = A[0]
    while x in A:
        A.remove(x)
  print(c)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
from collections import Counter
c = Counter(l)
v = list(c.values())
s = 0
for i in v:
  s += i*(i-1)//2
for i in l:
  print(s-(c[i]-1))
### BUGGY CODE ###


import math
import bisect


prime = [2,3,5,7]
for i in range(11,100000):

    x = int( math.sqrt(i) )
    x += 1 if x%2 == 0 else 0

    found = False
    for p in prime:
        if p>x:
            break;

        if i % p == 0:
            found = True
                
    if not found:
        prime.append(i)

#print(prime)


q = int(input())
for _ in range(q):
    l, r = map(int,input().split())
    l += 1 if l%2 == 0 else 0

#    print((l,r))

    ans = 0
    for i in range( l , r+1, 2):

        #si = bisect.bisect_left(prime,i)
        xi = bisect.bisect_right(prime, i)
        yi = bisect.bisect_right(prime, (i+1)//2)
        ans += 1 if prime[xi-1] == i and prime[yi-1] == (i+1)//2 else 0

    print(ans)

### FIXED CODE ###


import math
import bisect


prime = [2]

tab = [False]*100001
tab[2] = True
for i in range(3,100000+1,2):

    x = int( math.sqrt(i) )
    x += 1 if x%2 == 0 else 0

    found = False
    for p in prime:
        if x < p:
            break;

        if i % p == 0:
            found = True
            break
                
    if not found:
        prime.append(i)
        tab[i] = True

#print(prime[0:10])
#print(tab[0:10])
q = int(input())

ac = [0] * len(tab)

for i in range(1,len(ac)):
    ac[i] = ac[i-1] + (1 if tab[i] and tab[(i+1)//2] else 0)

#print(ac)
for _ in range(q):

    l, r = map(int,input().split())
    
    ans = ac[r] - ac[l-1]

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

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
n = int(input())
c = 1
ans = 0
while n-c>0:
  #print(make_divisors(n-c))
  ans += len(make_divisors(n-c))
  c += 1
print(ans)


### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n):
    ans += (n-1)//i
print(ans)