Harryxun/stf_run huggingface dataset:
def main():
    n = int(input())
    h_n = [int(s) for s in input().split()]

    for idx in range(1, n):
        diff = [h_n[idx] - h_n[i] for i in range(0, idx-1)]
        print(diff)
        diff = filter(lambda x: x >= 0, diff)

    print(len(list(diff)) + 1)
    
main()

### FIXED CODE ###

def main():
    n = int(input())
    h_n = [int(s) for s in input().split()]

    cnt = 0
    for i in range(0, n):
        diff = [h_n[i] - h_n[j] for j in range(0, i)]
        cnt = cnt + 1 if len(list(filter(lambda x: x < 0, diff))) == 0 else cnt

    print(cnt)

    
main()
A,B = input().split()
print(6-A-B)

### FIXED CODE ###

A = int(input())
B = int(input())
print(6-A-B)
N = int(input())
A = list(map(int,input().split(" ")))

def gcd (a: int,b: int) -> int:
    if a < b: a,b = b,a
    return a if b == 0 else gcd(b,a%b)
def lcm (a: int,b: int) -> int:
    return a // gcd(a,b) * b

def dfs(i,v,flg):
    if i == N-1:
        if flg:
            return gcd(A[N-1],v)
        else:
            return v
    if flg:
        return dfs(i+1,gcd(A[i],v),True)
    else:
        return max(dfs(i+1,gcd(v,A[i]),False),dfs(i+1,v,True))

if N == 2:
    print(max(A))
    exit(0)
else:
    print(max(dfs(1,A[0],False),dfs(2,A[1],True)))



### FIXED CODE ###

import sys
sys.setrecursionlimit(sys.getrecursionlimit())
N = int(input())
A = list(map(int,input().split(" ")))

def gcd (a: int,b: int) -> int:
    if a < b: a,b = b,a
    return a if b == 0 else gcd(b,a%b)
def lcm (a: int,b: int) -> int:
    return a // gcd(a,b) * b

gcdForward = [0] * N
gcdBackWard = [0] * N
gcdForward[0] =  A[0]
gcdBackWard[N-1] = A[-1]
for i in range(N-1):
    gcdForward[i+1] = gcd(gcdForward[i],A[i+1])
    gcdBackWard[N-i-2] = gcd(gcdBackWard[N-i-1],A[N-i-2])


if N == 2:
    print(max(A))
    exit(0)
else:
    ans = max(gcdBackWard[1],gcdForward[N-2])
    for i in range(1,N-1):
        ans = max(ans,gcd(gcdForward[i-1],gcdBackWard[i+1]))
    print(ans)
import sys
input = sys.stdin.readline

def main():
	N = int(input())
	a = list(map(int,input().split()))
	ball = []
	ballNum = 0
	f = [0]*N

	for i in reversed(range(N)):
		if (sum(f[0::i]) % 2) != (a[i] % 2):
			f[i] = 1
			ball.append(i+1)
			ballNum +=1

	print(ballNum)
	print(*ball)

if __name__ == "__main__":
	main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def sumN(n,N,f):
	total = 0
	i = n
	while i < N:
		total += f[i]
		i += n+1

	if total % 2:
		return 1
	else:
		return 0

def main():
	N = int(input())
	a = list(map(int,input().split()))
	ball = []
	ballNum = 0
	f = [0]*N

	for i in reversed(range(1,N)):
		if sumN(i,N,f) != (a[i] % 2):
			f[i] = 1
			ball.append(i+1)
			ballNum +=1

	if (sum(f) % 2) != (a[0] % 2):
		f[0] = 1
		ball.append(1)
		ballNum +=1

	print(ballNum)
	print(*ball)

if __name__ == "__main__":
	main()
import sys,math,collections,itertools
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A =[0]+list(map(int,input().split()))
town = 1
town_list = [1]
while True:
    town = A[town]
    if town not in town_list:
        town_list.append(town)
    else:
        roop_town_num = town
        break
    
l_ini_index = town_list.index(roop_town_num)
len_roop = len(town_list)-l_ini_index 

if K <= l_ini_index:
    print(town_lis[K])
else:
    print(town_list[((K-l_ini_index)%len_roop+l_ini_index)])
    


### FIXED CODE ###

import sys,math,collections,itertools
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A =[0]+list(map(int,input().split()))
town = 1
town_list = [1]
towntown = [0]*(N+1)
towntown[1]=1
count = 0
while True:
    town = A[town]
    count +=1
    if count == K:
        print(town)
        exit()
    if towntown[town] == 0:
        town_list.append(town)
        towntown[town] =1
    else:
        roop_town_num = town
        break
    
l_ini_index = town_list.index(roop_town_num)
len_roop = len(town_list)-l_ini_index 

if K <= l_ini_index:
    print(town_list[K])
else:
    print(town_list[((K-l_ini_index)%len_roop+l_ini_index)])
lw = input()
print(lw.startsWith("ABC") ? "ARC" : "ABC")


### FIXED CODE ###

tw ="ABC" if input().startswith("ARC") else "ARC"
print(tw)
H, W = (int(i) for i in input().split())
N = int(input())
A = [int(i) for i in input().split()]
C = []
for i in range(N):
  for j in range(a[i]):
    C.append(i+1)
ans = [[0]*W for i in range(H)]
for i in range(HW):
  y = i // W
  if y%2==0:
    x = i%W
  else:
    x = W-1-i%W
  ans[x][y] = C[i]
for i in range(H):
  ans[i] = [str(a) for a in ans]
  print(" ".join(ans[i]))
  

### FIXED CODE ###

H, W = (int(i) for i in input().split())
N = int(input())
A = [int(i) for i in input().split()]
C = []
for i in range(N):
  for j in range(A[i]):
    C.append(i+1)
ans = [[0]*W for i in range(H)]
for i in range(H*W):
  y = i // W
  if y%2==0:
    x = i%W
  else:
    x = W-1-i%W
  ans[y][x] = C[i]
for i in range(H):
  ans[i] = [str(a) for a in ans[i]]
  print(" ".join(ans[i]))
N,M=map(int, input().split())
pass_id = range(1,N+1)

for i in range(M):
    L,R=map(int, input().split())
    for id in pass_id:
        if not id in range(L,R+1):
            pass_id.pop(pass_id.index(id))
print(len(pass_id))

### FIXED CODE ###

N, M = map(int, input().split())
l, r = 1, N
for i in range(M):
    L, R = map(int, input().split())
    l = max(l, L)
    r = min(r, R)

print(max(0, r - l + 1))
N = int(input())
li = list(map(int,input().split()))
ans = "Yes"
b = 0
for i in range(N):
        b = max(b,li[i])
        if b > li[i]+1:
                ans = "No"
        

print(ans)

### FIXED CODE ###

(a,b,c) = map(int,input().split())
if c-(a-b)<0:
    print(0)
else:
    print(c-(a-b))
print("Yes" if int(input)*int(input) % 2 != 0 else "No")


### FIXED CODE ###

a, b = map(int, input().split())
print("Yes" if a*b % 2 != 0 else "No")
w=input()
a=("Sunny","Cloudy","Rainy")
b=a.index(w)
if b == 3:
    ans=1
else:
    ans=b+1
c=a[ans]
print(c)

### FIXED CODE ###

w=input()
a=("Sunny","Cloudy","Rainy")
b=a.index(w)
if b == 2:
    ans=0
else:
    ans=b+1
c=a[ans]
print(c)
# -*- coding: utf-8 -*-
N = int(input())
a = [input() for i in range(N)]
s = int(max(a)) // 2
a.remove(max(a)) #aの最大の要素を消去
print(sum(a) + s) #処理後のリストaにSを加えて足す

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
a = [int(input()) for i in range(N)]
s = int(max(a)) // 2
a.remove(max(a)) #aの最大の要素を消去
print(sum(a) + s) #処理後のリストaにSを加えて足す
n = int(input())
a = [*map(int, input().split())]
b = [*map(int, input().split())]
c = [*map(int, input().split())]

ans = b[a[0]-1]
for i in range(1,n):
    ans += b[a[i]-1]
    if a[i] > a[i-1]:
        ans += c[a[i]-2]
print (ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
 
ans = b[a[0]-1]
for i in range(1,n):
    ans += b[a[i]-1]
    if a[i]-a[i-1]==1:
        ans += c[a[i-1]-1]
print (ans)
x, y, z = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
 
if x = 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

### FIXED CODE ###

s = input()

a, b = s.split()
if a.isdigit():
  a = int(a)
else:
  a = ord(a) - 50

if b.isdigit():
  b = int(b)
else:
  b = ord(b) - 50

if a < b:
  print("<")
elif a > b:
  print(">")
else:
  print("=")
import bisect

n, m = map(int, input().split())
f_1 = []
t_n = []
jedge = 0
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        f_1.append(b)
    if b == n:
        t_n.append(a)
f_1.sort()
t_n.sort()
for i in range(len(f_1)):
    p = bisect.bisect_left(t_n, f_1[i])
    if p != len(t_n) and f_1[i] == t_n[p+1]:
        jedge = 1
        break
    elif p == len(t_n) and f_1[i] == t_n[p]:
        jedge = 1
        break
if jedge == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


### FIXED CODE ###

import bisect

n, m = map(int, input().split())
f_1 = []
t_n = []
jedge = 0
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        f_1.append(b)
    if b == n:
        t_n.append(a)
f_1.sort()
t_n.sort()
for i in range(len(f_1)):
    p = bisect.bisect_left(t_n, f_1[i])
    if p < len(t_n)-1 and f_1[i] == t_n[p]:
        jedge = 1
        break
    elif p == len(t_n)-1 and f_1[i] == t_n[p]:
        jedge = 1
        break
if jedge == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
from collections import defaultdict

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

d = defaultdict(list)
root = []
p = 1

s, e = 0, 0

for i in range(K):
    d[p].append(i)
    root.append(A[p - 1])
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        break
    p = A[p - 1]
#print(s, e)

#print(root)

n = (K - s) % (e - s)
#print(n)
print(root[s + n - 1])

### FIXED CODE ###

from collections import defaultdict

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

d = defaultdict(list)

p = 1
root = []

#s, e = 0, 0

for i in range(K):
    d[p].append(i)
    root.append(p)
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        n = (K - s) % (e - s)
        p = root[s + n]
        break
    p = A[p - 1]
#print(s, e)

#print(root)

#n = (K - s) % (e - s)
print(p)
import sys
# スペース区切りの整数入力
N,M = map(int, input().split())

sc = {}
snum = '0' * N

for i in range(M):
    s,c = map(int, input().split())
    if s in sc:
        if c != sc[s]:
            print(-1)
            sys.exit()
    sc[s] = c

for i in sc:
    snum = snum[:i-1] + str(sc[i]) + snum[i:] 

if N == len(str(int(snum))):
    print(snum)
else:
    if 1 in sc:
        print(-1)
    else:
        print(1+snum[1:])



### FIXED CODE ###

import sys
# スペース区切りの整数入力
N,M = map(int, input().split())

sc = {}
snum = '0' * N

for i in range(M):
    s,c = map(int, input().split())
    if s in sc:
        if c != sc[s]:
            print(-1)
            sys.exit()
    sc[s] = c

for i in sc:
    snum = snum[:i-1] + str(sc[i]) + snum[i:] 

if N == len(str(int(snum))):
    print(snum)
else:
    if 1 in sc:
        print(-1)
    else:
        print("1"+snum[1:])
N, X, T = map(int, raw_input().split())

for i in range(1001):
    if i * X >= N:
        print (i * T)
        break


### FIXED CODE ###

N, X, T = map(int, input().split())

for i in range(1001):
    if i * X >= N:
        print (i * T)
        break
import os

input = sys.stdin.readline

N = int(input())

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

ans = False
b = [0]*N

for i in range(N, 0 ,-1):
    b_sum = 0
    for j in range(i, N+1, i):
        b_sum += b[j-1]
    if b_sum % 2 != a[i-1]: b[i-1] = 1
if b==[0]*N:print(0)      
else:
    print(sum(b))
    print(*[k+1 for k, l in enumerate(b) if l==1])

### FIXED CODE ###

N = int(input())

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

ans = False
b = [0]*N


for i in range(N, 0 ,-1):
    b_sum = 0
    for j in range(i, N+1, i):
        b_sum += b[j-1]
    if b_sum % 2 != a[i-1]: b[i-1] = 1
if b==[0]*N:print(0)      
else:
    print(sum(b))
    print(*[k+1 for k, l in enumerate(b) if l==1])
n = int(input())
x = list(map(int, input().split()))
if n == 0:
    print(n)
    exit()
ans = []
for i in range(1, max(x)):
    p = 0
    for j in x:
        p += (j - i)**2
    ans.append(p)
print(min(ans))


### FIXED CODE ###

n = int(input())
x = list(map(int, input().split()))
ans = []

for i in range(1, max(x)+1):
    p = 0
    for j in x:
        p += (j - i) ** 2
    ans.append(p)

if len(ans) == 0:
    print(0)
    exit()
print(min(ans))
X = int(input())

go = [i**5 for i in range(1000)]


def foo():
    for i in range(1000):
        for j in range(i, 1000):
            if go[i] - go[j] == X:
                return i, j
        for j in range(1000):
            if go[i] + go[j] == X:
                return i, -j


A, B = foo()
print(A, B)


### FIXED CODE ###

X = int(input())

R = 3000
go = [i**5 for i in range(R)]


def foo():
    for i in range(R):
        for j in range(R):
            if go[i] - go[j] == X:
                return i, j
        for j in range(i, R):
            if go[i] + go[j] == X:
                return i, -j

    return 0, 0


A, B = foo()
print(A, B)
from itertools import accumulate
from collections import Counter
import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline
n=int(input())
A=list(map(int,input().split()))
S=list(accumulate(A))
C=Counter(S)

def num(m):
    return m*(m-1)//2

ans=0
for k,v in C.items():
    if k==0:
        ans+=v
    if v>1:
        ans+=comb(v)
print(ans)

### FIXED CODE ###

from itertools import accumulate
from collections import Counter
import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline
n=int(input())
A=list(map(int,input().split()))
S=list(accumulate(A))
C=Counter(S)

def num(m):
    return m*(m-1)//2

ans=0
for k,v in C.items():
    if k==0:
        ans+=v
    if v>1:
        ans+=num(v)
print(ans)
a = map(int,raw_input().split())
s = l[0] * l[1]
shu = l[0] * 2 + l[1] * 2
fmt = "{s} {shu}"
s = fmt.format(s = s,shu = shu)
print(s)

### FIXED CODE ###

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

s = a * b
shu = a * 2 + b * 2
fmt = "{s} {shu}"
s = fmt.format(s = s,shu = shu)
print(s)
word1,word2,word3 = map(str,input().split())
if word1[-1] == word2[1] and word2[-1] == word3[1]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

word1,word2,word3 = map(str,input().split())
if word1[-1] == word2[0] and word2[-1] == word3[0]:
  print("YES")
else:
  print("NO")
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

def gettwice(n, cnt):
    if n % 2 == 1:
       return cnt

    return gettwice(n/2, cnt+1)

n = getInputInt()
data = getInputListInt()

ans = 0
tmpans = 0

oddData = []
evenData = []

for i in range(len(data)):
    if data[i] % 2 == 0:
        evenData.append(data[i])
    else:
        oddData.append((data[i]))

maxOddNum = max(oddData)

for i in range(len(evenData)):
        tmpans += gettwice(evenData[i], 0)

# counter = 0
# for i in range(int(tmpans)):
#     maxOddNum = maxOddNum * 3
#     if maxOddNum > 1000000000:
#         break
#     counter = i+1

# ans = min(tmpans, counter)

print(tmpans)

### FIXED CODE ###

import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

def gettwice(n):
    counter = 0
    flg = True
    while (flg):
        if n % 2 == 1:
            flg = False
        else:
            n = n / 2
            counter += 1

    return counter


k = getInputInt()
data = getInputListInt()

ans = 0

for i in range(len(data)):
    ans += gettwice(data[i])

print(ans)
a_len = int(input())
a_ar = sorted([int(n) for n in input().split(" ")])
b_len = int(input())
b_ar = [int(n) for n in input().split(" ")]
max_b = max(b_ar)
dp = [0 for n in range(max_b + 1)]
for a in a_ar:
    new_dp = dp[:]
    new_dp[a] = 1
    for i,d in enumerate(dp):
        if d and i + a <= max_b + 1:
            new_dp[i + a] = 1
    dp = new_dp
for b in b_ar:
    if dp[b]:
        print("yes")
    else:
        print("no")

### FIXED CODE ###

a_len = int(input())
a_ar = sorted([int(n) for n in input().split(" ")])
b_len = int(input())
b_ar = [int(n) for n in input().split(" ")]
max_b = max(b_ar)
dp = [0 for n in range(max_b + 1)]
for a in a_ar:
    new_dp = dp[:]
    new_dp[a] = 1
    for i,d in enumerate(dp):
        if d and i + a <= max_b:
            new_dp[i + a] = 1
    dp = new_dp
for b in b_ar:
    if dp[b]:
        print("yes")
    else:
        print("no")
N, K, L = map(int, input().split())

par = [i for i in range(N)]
size = [1] * N


def find(x, P):
    if P[x] == x:
        return x
    else:
        return find(P[x], P)

def unite(x, y):
    x = find(x, par)
    y = find(y, par)

    if x != y:
        # xとyの属している集合が異なる時
        par[x] = y

par2 = [i for i in range(N)]
def unite2(x, y):

    x = find(x, par2)
    y = find(y, par2)

    if x != y:
        # xとyの属している集合が異なる時
        par2[x] = y
        s = size[x] + size[y]
        size[y] = s

for _ in range(K):
    p, q = map(int, input().split())
    unite(p-1, q-1)


#print(par)

root =[find(i, par) for i in range(N)]

### FIXED CODE ###

from collections import Counter

n,k,l=map(int,input().split())
city1=[i for i in range(n)]
city2=[i for i in range(n)]

def root(c,x):
  if x==c[x]:
    return x
  else:
    c[x]=root(c,c[x])
    return c[x]

def union(c,x,y):
  rx=root(c,x)
  ry=root(c,y)
  if rx>ry:
    c[rx]=ry
  else:
    c[ry]=rx

for i in range(k):
  a,b=map(int,input().split())
  union(city1,a-1,b-1)
for i in range(l):
  a,b=map(int,input().split())
  union(city2,a-1,b-1)
r=[]
for i in range(n):
  r.append((root(city1,i),root(city2,i)))
c=Counter(r)
for i in range(n):
  ans=c[r[i]]
  if i==n-1:
    print(ans)
  else:
    print(ans,end=' ')
import sys

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if V <= W:
  print('NO')
  sys.exit()
if 0 < abs((B-A)//(V-W)) <= T:
  print('YES')import sys

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if V <= W:
  print('NO')
  sys.exit()
t= abs(B-A)%(V-W)
if 0 < abs((B-A)//(V-W)) <= T:
  print('YES')
else:
  print('NO')



### FIXED CODE ###

import sys

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if V <= W:
  print('NO')
  sys.exit()
if 0 < abs((B-A))/(V-W) <= T:
  print('YES')
else:
  print('NO')
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

n += 5

sa = set(a)
sb = set(b)

count = [0] * n
counta = [0] * n
countb = [0] * n
for v in a:
    count[v] += 1
    counta[v] += 1
for v in b:
    count[v] += 1
    countb[v] += 1

outA = dict()
for v in a:
    outA[v] = []

import heapq
q = []
for v in range(n):
    if count[v]:
        heapq.heappush(q,(-count[v],v))
    
while q[0][0] < 0:
    c, v = heapq.heappop(q)
    if count[v] + c:
        heapq.heappush(q,(-count[v],v))
        continue
    if counta[v]:
        for v2 in sb:
            if v2 != v:
                break
        else:
            print('No')
            exit()
        outA[v].append(v2)
        count[v] -= 1
        count[v2] -= 1
        counta[v] -= 1
        countb[v2] -= 1
        if counta[v] == 0:
            sa.remove(v)
        if countb[v2] == 0:
            sb.remove(v2)
    else:
        for v2 in sa:
            if v2 != v:
                break
        else:
            print('No')
            exit()
        outA[v2].append(v)
        count[v] -= 1
        count[v2] -= 1
        counta[v2] -= 1
        countb[v] -= 1
        if counta[v2] == 0:
            sa.remove(v2)
        if countb[v] == 0:
            sb.remove(v)
    if count[v]:
        heapq.heappush(q, (-count[v], v))

out = []
for v in a:
    out.append(outA[v].pop())
print('Yes')
print(' '.join(map(str,out)))


### FIXED CODE ###

print(1-int(input()))
if int(map(int, input().split()).join()) % 4 == 0:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

if int("".join(list(map(str, input().split())))) % 4 == 0:
  print('YES')
else:
  print('NO')
print(x*x*x)
   x=2


### FIXED CODE ###

x = int(input())
print(x*x*x)
def calcH(x, cx, y, cy, h):
    return abs(x-cx)+abs(y-cy)+h
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
Hmax = 10**9
lst = [[x, y] for x in range(101) for y in range(101)]
for i, j in lst:
    k = 0
    flag = True
    for x, y, h in xyh:
        H_ = calcH(x, i, y, j, h)
        if H_ > Hmax and h != 0:
            flag = False
            break
        if k > 0:
            if H_ != H and flag and h != 0:
                flag = False
                break
            elif H_ != H and not flag and h == 0:
                if H_ < H:
                    H = H_
            elif H_ != H and h == 0:
                if H_ <= H:
                    flag = False
                    break
            elif H_ != H:
                H = H_
                flag = True
            else:
                flag = True
        else:
            H = H_
            if h == 0 and n == 1:
                flag = False
        k += 1
    if k < n or H > Hmax:
        continue
    else:
        Cx = i
        Cy = j
        Ch = H
    break
print(Cx, Cy, Ch)

### FIXED CODE ###

def calcCh(cx, cy, x, y, h):
    return abs(x-cx)+abs(y-cy)+h
def calcH(cx, cy, ch, x, y, h):
    return max(ch - calcCh(cx, cy, x, y, 0), 0)
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh = sorted(xyh, key = lambda x: x[2])[::-1]
lst = [[x, y] for x in range(101) for y in range(101)]
for Cx, Cy in lst:
    Ch = calcCh(Cx, Cy, *xyh[0])
    if all(xyh[i][2] == calcH(Cx, Cy, Ch, *xyh[i]) for i in range(n)):
        break
print(Cx, Cy, Ch)
N =int(input())
#graph作成
graph = [[] for _ in range(N)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    graph[a-1].append((b-1,c))
    graph[b-1].append((a-1,c))
Q, K = map(int, input().split())
K -= 1
query = [tuple(int(x) for x in input().split()) for _ in range(Q)]


def dfs(v, graph, seen, dist, distfromK):
    for next_v in graph[v]:
        if next_v[0] in seen:
            continue
        seen.append(next_v[0])
        ndist = dist + next_v[1]
        distfromK[next_v[0]] = ndist
        dfs(next_v[0], graph, seen, ndist, distfromK)


#dfs
seen = [K]
distfromK =[0] * N
dfs(K, graph, seen, 0, distfromK)

for q in query:
    print(distfromK[q[0]-1]+distfromK[q[1]-1])





### FIXED CODE ###

N =int(input())
#graph作成
graph = [[] for _ in range(N)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    graph[a-1].append((b-1,c))
    graph[b-1].append((a-1,c))

Q, K = map(int, input().split())
K -= 1
query = [tuple(int(x) for x in input().split()) for _ in range(Q)]

        
seen = {K} 
v = [K]
distfromK =[0] * N
while len(v) != 0:  #bfsでdistfromKを埋めていく
    for nv in graph[v[0]]:
        if nv[0] in seen:
            continue
        distfromK[nv[0]] = distfromK[v[0]] + nv[1]
        v.append(nv[0])
        seen.add(nv[0])
    v.pop(0)

for q in query:
    print(distfromK[q[0]-1]+distfromK[q[1]-1])
from sys import stdin
import bisect
from itertools import groupby
 
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
 
li.sort()
lin = []

for key, value in groupby(li):
    lin.append((key,len(list(value))))

lin.sort()

if lin[0][0] != 0 or lin[0][1] > 1:
    print(0)
    exit()

point = 1
for i in range(1,len(lin)):
    if lin[i-1][0]+1 != lin[i][0]:
        print(0)
        exit()
    
    point *= (lin[i-1][1]**lin[i][1])

print(point%998244353)

### FIXED CODE ###

from sys import stdin
import fractions

n = int(stdin.readline().rstrip())

if n %2 == 1:
    print(n//2)
else:
    print(n//2-1)