A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.

There are n schools numerated from 1 to n. One can travel between each pair of them, to do so, he needs to buy a ticket. The ticker between schools i and j costs $(i + j) \operatorname{mod}(n + 1)$ and can be used multiple times. Help Sajjad to find the minimum cost he needs to pay for tickets to visit all schools. He can start and finish in any school.


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 10^5) — the number of schools.


-----Output-----

Print single integer: the minimum cost of tickets needed to visit all schools.


-----Examples-----
Input
2

Output
0

Input
10

Output
4



-----Note-----

In the first example we can buy a ticket between the schools that costs $(1 + 2) \operatorname{mod}(2 + 1) = 0$.

Difficulty: EASY
Tags: Greedy algorithms

Mathematics

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
n = int(input())
n -= 1
print(n // 2)


n = int(input())
if n == 1:
	print(0)
elif n % 2 == 0:
	print(n // 2 - 1)
else:
	print((n + 1) // 2 - 1)


n = int(input())
if n & 1:
	print(n // 2)
else:
	n -= 2
	print(n // 2)


import sys
n = int(input())
if n > 1:
	if n % 2 == 0:
		result = int(n / 2 - 1)
	else:
		result = int(n / 2 - 1) + 1
else:
	result = 0
print(result)


def mp():
	return map(int, input().split())

def lt():
	return list(map(int, input().split()))

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def ptlist(l):
	print(' '.join([str(x) for x in l]))
n = it()
pt((n - 1) // 2)


t = int(input())
sum = (t - 1) / 2
print(int(sum))


n = int(input().strip())
if n % 2 == 0:
	print(n // 2 - 1)
else:
	print(n // 2)


from math import ceil
n = int(input())
yy = ceil(n / 2)
print((yy + n) % (n + 1) if n != 2 else 0)


print((int(input()) - 1) // 2)


print(int(input()) - 1 >> 1)


n = eval(input())
if n % 2 == 0:
	print((n - 2) // 2)
else:
	print(n // 2)


import sys
input = sys.stdin.readline
n = int(input())
print((n - 1) // 2)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def main():
	n = I()
	return n // 2 - 1 + n % 2
print(main())


i = int(input())
if i % 2:
	print((i - 1) // 2)
else:
	print(i // 2 - 1)


n = int(input())
(l, r) = (1, n)
cost = 0
while l < r:
	cost += (r + l) % (n + 1)
	l += 1
	if l == r:
		break
	cost += (r + l) % (n + 1)
	r -= 1
print(cost)


a = int(input())
if a % 2 == 0:
	x = int(a / 2 - 1)
	print(x)
if a % 2 != 0:
	y = int((a + 1) / 2 - 1)
	print(y)


import math
N = int(input())
print(math.ceil(N / 2) - 1)


n = int(input())
if n % 2 == 0:
	print((n - 2) // 2)
else:
	print(n // 2)


x = int(input())
if x % 2 != 0:
	x = x + 1
r = x // 2 - 1
print(r)


n = int(input())
q = 2
r = n + 2
if n % 2 == 0:
	print(n // 2 - 1)
else:
	print(n // 2)


a = int(input())
import math
ans = math.ceil(a / 2) - 1
print(ans)


a = int(input())
if a % 2 == 0:
	print((a - 1) // 2)
else:
	print(a // 2)


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
n = I()
cur = 1
cnt = 2
ans = 0
while cnt < n:
	if cur < n // 2:
		cur = n + 1 - cur
		cnt += 1
	elif cur == (n + 1) // 2:
		break
	else:
		cur = n + 2 - cur
		cnt += 1
		ans += 1
print(ans)


import math
n = int(input())
answer = (math.ceil(n / 2) + n) % (n + 1)
print(answer)


from sys import stdin, stdout

def readint():
	return map(int, stdin.readline().split())
n = int(input())
a = n // 2
if n % 2:
	a += 1
print(a - 1)


n = int(input())
if n % 2 == 0:
	print(int((n - 2) / 2))
if n % 2 == 1:
	print(int((n - 1) / 2))


n = int(input())
cnt = 1
i = 1
ans = 0
while cnt != n:
	i = n + 1 - i
	if cnt % 2 == 0:
		i += 1
		ans += 1
	cnt += 1
print(ans)


n = int(input())
res = 0
a = 1
b = n
c = True
while a < b:
	res += (a + b) % (n + 1)
	if c == True:
		a += 1
	else:
		b -= 1
	c = not c
print(res)


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y

def di():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
n = int(input())
if n % 2:
	print(n // 2)
else:
	print(n // 2 - 1)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	n = scanner()
	print((n - 1) // 2)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(1):
	solve()


from sys import stdin
inFile = stdin
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = inFile.readline().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())

def cost(perm):
	cost = 0
	for i in range(len(perm) - 1):
		cost += (perm[i] + perm[i + 1]) % (n + 1)
	return cost
from itertools import permutations
n = nextInt()
(l, r) = (1, n)
left = True
perm = []
while l <= r:
	if left:
		perm += [l]
		l += 1
	else:
		perm += [r]
		r -= 1
	left = not left
print(cost(perm))


import sys, itertools, math

def ia():
	return [int(i) for i in sys.stdin.readline().strip().split(' ')]

def ii():
	return int(sys.stdin.readline().strip())

def istr():
	return sys.stdin.readline().strip()
n = ii()
print(n - n // 2 - 1)


n = int(input())
(s, e) = (1, n)
ans = 0
f = 1
while s < e:
	ans += (s + e) % (n + 1)
	if f:
		s += 1
	else:
		e -= 1
	f ^= 1
print(ans)


from sys import stdin, stdout
n = int(stdin.readline())
ans = n % 2 + (n - 2) // 2
stdout.write(str(ans))


from math import *
n = int(input())
print(int(ceil(n / 2) - 1))


a = int(input())
print((a - 1) // 2)


I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
n = I()
print((n + 1) // 2 - 1)


inp = int(input())
print((inp - 1) // 2)


import sys
fin = sys.stdin
fout = sys.stdout
n = int(fin.readline())
ans = 0
s = set()
for i in range(1, n + 1):
	s.add(i)
cur = 1
s.discard(1)
while len(s) > 0:
	next = n + 1 - cur
	if next not in s:
		next -= n
		next %= n + 1
		while next not in s:
			next += 1
	ans += (cur + next) % (n + 1)
	s.discard(next)
	cur = next
fout.write(str(ans))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
print((N - 1) // 2)


n = int(input())
cost = 0
d = {1: 1}
pos = 1
flag = True
pre = 1
k = 0
while k < n:
	if flag:
		pos = n + 1 - pos
		d[pos] = 1
		k += 1
		flag = False
	else:
		pos = pre + 1
		pre += 1
		k += 1
		if pos not in d:
			d[pos] = 1
			cost += 1
		flag = True
print(cost)


x = int(input())
n = int(x)
a = 0
list1 = list()
if n % 2 == 0:
	for i in range(int(n / 2)):
		list1.append(i + 1)
		list1.append(n - i)
else:
	for i in range(int(n / 2) + 1):
		list1.append(i + 1)
		while i < n - 1:
			list1.append(n - i)
			break
for j in range(n - 1):
	a += (list1[j] + list1[j + 1]) % (n + 1)
print(a)


n = int(input())
m = n + 1
a = (n - 2) // 2 + n % 2
print(a)


N = int(input())
if N % 2 == 0:
	print(N // 2 - 1)
else:
	print(N // 2)


a = int(input())
if a == 1:
	print('0')
else:
	s = 1
	t = a
	q = []
	if a % 2 == 0:
		while t > s:
			q += [s]
			q += [t]
			s += 1
			t -= 1
	else:
		while t != s:
			q += [s]
			q += [t]
			s += 1
			t -= 1
		q += [s]
	i = 0
	wyn = 0
	while i < len(q) - 1:
		wyn += (q[i] + q[i + 1]) % (a + 1)
		i += 1
	print(wyn)


x = int(input())
x = x - 1
print(int(x / 2))


from math import *
n = int(input())
low = 1
high = n
mod = n + 1
ans = 0
f = 1
while low < high:
	ans += (low + high) % mod
	if f:
		low += 1
	else:
		high -= 1
	f = f ^ 1
print(ans)


def solve():
	n = int(input())
	if n & 1:
		n += 1
	return n // 2 - 1
print(solve())


n = int(input())
if n < 3:
	print(0)
else:
	print((n + 1 >> 1) - 1)


n = int(input())
res = 0
if n & 1:
	res = n // 2 + 1
else:
	res = n // 2
print(int(res - 1))


import sys
n = int(input())
print((n - 1) // 2)


x = int(input())
if x % 2 == 0:
	print(int(x / 2 - 1))
else:
	print(int(x / 2))


n = int(input())
if n in (1, 2):
	print(0)
else:
	if n % 2 != 0:
		n += 1
	print(n // 2 - 1)


n = int(input())
if n % 2 == 0:
	print(str(int(n / 2 - 1)))
	exit()
print(str(int(n // 2)))


import sys

def solve():
	num = int(input())
	print((num - 1) // 2)
solve()


import sys
import math
n = int(input())
print(max(n // 2 + n % 2 - 1, 0))


a = int(input())
if a == 1 or a == 2:
	print(0)
else:
	print((a - 3) // 2 + 1)


n = int(input())
print(n // 2 - ~n % 2)


schools = int(input())
print((schools - 1) // 2)


import math

def ans(n):
	if n is 1:
		return 0
	if n % 2 is 0:
		return math.floor((n - 2) / 2)
	else:
		return 1 + math.floor((n - 2) / 2)
n = int(input())
print(ans(n))


n = int(input())
ans = 0
print(int(n / 2 + n % 2 - 1))


import math
print(int(math.ceil((int(input()) - 2) / 2)))


n = int(input())
if n % 2 == 0:
	ans = (n - 2) // 2
else:
	ans = (n - 1) // 2
print(ans)


def Findpath(n):
	if n % 2 == 0:
		return int(n / 2 - 1)
	else:
		return int((n + 1) / 2 - 1)
n = int(input())
print(Findpath(n))


n = int(input())
v = n // 2 - 1 if n % 2 == 0 else n // 2
print(v)


import math

def main():
	n = int(input())
	print(n // 2 - 1 + n % 2)
main()


print(str((int(input()) - 1) // 2))


def main():
	n = int(input())
	print((n - 1) // 2)
main()


n = int(input())
print(n - 1 >> 1)


n = int(input())
vis = [0] * n
ans = 0
for i in range(n):
	if vis[i] == 0:
		ans += 1
		vis[i] = 1
		vis[n + 1 - i - 2] = 1
ans -= 1
print(ans)


n = int(input())
k = 1
c = 0
i = 1
j = n
while i < j:
	c += (i + j) % (n + 1)
	if k % 2 == 1:
		i += 1
	else:
		j -= 1
	k += 1
print(c)


import sys
x = int(input())
y = x / 2
if x == 1:
	print(0)
	sys.exit()
wynik = (x + y) % (x + 1) + 0.5
print(int(wynik))


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(int)
n = I()
print((n + 1) // 2 - 1)


import sys

def main():
	n = int(sys.stdin.readline())
	res = int((n - 1) / 2)
	print('%s' % res)
main()


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from fractions import Fraction
import math

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = defaultdict(list)
	for i in range(e):
		(x, y) = mi()
		d[x].append(y)
		d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n + 1):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
n = ii()
c = n // 2 - 1
if n % 2 == 0:
	print(c)
else:
	c += n // 2 + 1
	print(c // 2)


def arin():
	arr = list(map(int, input().strip().split(' ')))
	return arr
n = int(input())
print((n - 1) // 2)


from sys import stdin, stdout
n = int(stdin.readline().rstrip())
if n % 2:
	print((n - 1) // 2)
else:
	print(n // 2 - 1)


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

def getStrs():
	return input().split()

def isInt(s):
	return '0' <= s[0] <= '9'

def input():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in input().split()]

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
n = getInt()
print(ceil(n / 2) - 1)


print(0 - -int(input()) // 2 - 1)


import sys
fin = sys.stdin
n = int(fin.readline())
print((n - 1) // 2)


ka = int(input())
print((ka - 1) // 2)


import sys
n = int(sys.stdin.read())
print((n - 1) // 2)


import sys
read = lambda : sys.stdin.readline().rstrip()
readi = lambda : int(sys.stdin.readline())
writeln = lambda x: sys.stdout.write(str(x) + '\n')
write = lambda x: sys.stdout.write(x)
N = readi()
writeln((N - 1) // 2)


n = int(input())
mod = 1 + n
ans = 0
cnt = 1
big = n
small = 1
while cnt != n:
	if cnt % 2 == 1:
		ans += (small + big) % mod
		small += 1
		cnt += 1
	else:
		ans += (small + big) % mod
		big -= 1
		cnt += 1
print(ans)


def boka():
	s = int(input())
	s -= 1
	s /= 2
	s = int(s)
	print(s)
boka()


import itertools

def solve(n):
	ans = (n + 1) // 2
	return ans - 1

def main():
	n = int(input())
	print(solve(n))
main()


import sys

def solve():
	n = int(input())
	ans = (n - 1) // 2
	print(ans)
solve()


k = int(input())
print((k - 1) // 2)


import math
import re
import random
n = int(input())
if n % 2 == 0:
	print(n // 2 - 1)
else:
	print(n // 2)


n = int(input().strip())
if n % 2 == 1:
	n += 1
n -= 2
print(int(n // 2))


import math
n = int(input())
print(math.ceil(n / 2.0 - 1))


n = int(input())
mid = 0
if n % 2 == 0:
	mid = int(n / 2 + 1)
else:
	mid = int((n + 1) / 2)
print(n - mid)


n = int(input())
print(n // 2 - (n % 2 == 0))


from math import ceil
n = int(input())
print(ceil(max(0, n / 2 - 1)))


import sys
import math
from sys import stdin, stdout

def get_ints_in_variables():
	return map(int, sys.stdin.readline().strip().split())

def get_ints_in_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def Solution(s):
	pass

def main():
	n = int(input()) - 1
	res = n // 2
	print(res)
main()


N = int(input())
if N % 2 != 0:
	N = N + 1
R = N // 2 - 1
print(R)


n = int(input())
if n == 1 or n == 2:
	print(0)
else:
	print((n - 1) // 2)


n = int(input())
if n % 2 == 0:
	print(str(n // 2 - 1))
else:
	print(str((n - 1) // 2))


import sys
input = sys.stdin.readline

def li():
	return [int(i) for i in input().rstrip('\n').split(' ')]

def st():
	return input().rstrip('\n')

def val():
	return int(input())
print((val() - 1) // 2)


import math
n = int(input())
if n % 2 == 0:
	print(n // 2 - 1)
else:
	print(n // 2)


import sys
import bisect
import math as mt
input = sys.stdin.readline
t = 1
mod = 10 ** 9 + 7
for _ in range(t):
	n = int(input())
	if n % 2 != 0:
		n += 1
	ans = n // 2 - 1
	print(ans)


n = int(input())
k = (n - 2) // 2 + (n - 2) % 2
print(k)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
import itertools

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	n = Int()
	print(ceil(n / 2) - 1)
solution()


from math import *
n = int(input())
if (n - 2) % 2 == 0:
	print((n - 2) // 2)
else:
	print(floor((n - 2) / 2) + 1)


def find(n):
	return (n + 1) // 2 - 1
print(find(int(input())))


n = int(input())
c = n // 2
if (n + 1) % 2 == 0:
	print(c)
else:
	print(c - 1)


def ticket_pricing(n):
	if n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2 - 1 + 1
n = int(input())
print(ticket_pricing(n))


n = int(input())
k = n + (n - 1)
m = k % (n + 1)
if n == 1:
	print(0)
	exit()
elif m % 2 == 0:
	print(m // 2)
else:
	print(m // 2 + 1)


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


n = int(input())
ans = n // 2 - 1 if not n & 1 else n // 2
print(ans)


n = eval(input())
if n % 2 == 0:
	print(int(n / 2 - 1))
else:
	print(int(n / 2))


def amir(n):
	n -= 1
	return n // 2
print(amir(int(input())))


import math as ma
from sys import exit
from decimal import Decimal as dec

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())
n = nu()
x = 0
if n % 2 == 0:
	x = (n - 1) // 2
else:
	x = n // 2
print(x)


n = int(input())
sum = 0
first = 1
last = n
flag = True
while first < last:
	sum += (first + last) % (n + 1)
	if flag == True:
		flag = False
		first += 1
	else:
		flag = True
		last -= 1
print(sum)


from sys import stdin, stdout
from collections import *
from math import ceil, floor, log, gcd
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	pr(max(0, ceil(n / 2) - 1))
for _ in range(1):
	solve()


N = eval(input())
print(int(N / 2 - 0.5))


l = int(input())
if l % 2 == 0:
	print(l // 2 - 1)
else:
	print(l // 2)


from itertools import permutations
from collections import defaultdict
from math import *
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import *
import copy
import itertools
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
n = int(input())
if n <= 2:
	print('0')
else:
	print(int(ceil((n - 2) / 2)))


X = int(input())
print(X // 2 - 1 if X % 2 == 0 else X // 2)


from sys import stdin
n = int(stdin.readline())
print((n - 1) // 2)


import math, string, itertools, collections, re, fractions, array, copy
import bisect
import heapq
from itertools import chain, dropwhile, permutations, combinations
from collections import deque, defaultdict, OrderedDict, namedtuple, Counter, ChainMap

def VI():
	return list(map(int, input().split()))

def I():
	return int(input())

def LIST(n, m=None):
	return [0] * n if m is None else [[0] * m for i in range(n)]

def ELIST(n):
	return [[] for i in range(n)]

def MI(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = VI()
	return arr

def MS(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = input()
	return arr

def MIT(n=None, m=None):
	if n is None:
		(n, m) = VI()
	a = MI(n, m)
	arr = LIST(m, n)
	for (i, l) in enumerate(a):
		for (j, x) in enumerate(l):
			arr[j][i] = x
	return arr

def main(info=0):
	n = I()
	print((n - 1) // 2)
main()