There are two sisters Alice and Betty. You have $n$ candies. You want to distribute these $n$ candies between two sisters in such a way that:  Alice will get $a$ ($a > 0$) candies;  Betty will get $b$ ($b > 0$) candies;  each sister will get some integer number of candies;  Alice will get a greater amount of candies than Betty (i.e. $a > b$);  all the candies will be given to one of two sisters (i.e. $a+b=n$). 

Your task is to calculate the number of ways to distribute exactly $n$ candies between sisters in a way described above. Candies are indistinguishable.

Formally, find the number of ways to represent $n$ as the sum of $n=a+b$, where $a$ and $b$ are positive integers and $a>b$.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then $t$ test cases follow.

The only line of a test case contains one integer $n$ ($1 \le n \le 2 \cdot 10^9$) — the number of candies you have.


-----Output-----

For each test case, print the answer — the number of ways to distribute exactly $n$ candies between two sisters in a way described in the problem statement. If there is no way to satisfy all the conditions, print $0$.


-----Example-----
Input
6
7
1
2
3
2000000000
763243547

Output
3
0
0
1
999999999
381621773



-----Note-----

For the test case of the example, the $3$ possible ways to distribute candies are:  $a=6$, $b=1$;  $a=5$, $b=2$;  $a=4$, $b=3$.

Difficulty: EASY

Solutions:
from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	print((n - 1) // 2)


import sys
input = sys.stdin.readline
from collections import defaultdict as dd
t = int(input())
while t:
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
	t -= 1


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

def gift():
	for _ in range(t):
		n = int(input())
		if n % 2:
			yield (n // 2)
		else:
			yield (n // 2 - 1)
t = int(input())
ans = gift()
print(*ans, sep='\n')


t = int(input())
for tt in range(t):
	n = int(input())
	if n < 3:
		print(0)
	elif n % 2 == 0:
		b = int(n / 2) - 1
		print(b)
	elif n % 2 == 1:
		b = int(n / 2)
		print(b)


total = int(input())
for _ in range(total):
	n = list(map(int, input().split()))[0]
	if n == 1:
		print(0)
		continue
	print((n - 1) // 2)


T = int(input())
for _ in range(T):
	n = int(input())
	if n == 0 or n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


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


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
import bisect

def func(x):
	return s[x % (a * b)] + x // (a * b) * s[a * b - 1]
for _ in range(I()):
	n = I()
	print(max(n - n // 2 - 1, 0))


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


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


for y in range(int(input())):
	n = int(input())
	print((n - 1) // 2)


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	if n <= 2:
		stdout.write('0' + '\n')
	elif n % 2 == 0:
		stdout.write(str(int(n / 2) - 1) + '\n')
	else:
		stdout.write(str(int(n / 2)) + '\n')


t = int(input())
for i in range(t):
	numbers = map(int, input().split())
	for num in numbers:
		if num % 2 == 0:
			print(num // 2 - 1)
		else:
			print(num // 2)


t = int(input())
for i in range(t):
	n = int(input())
	print((n - 1) // 2)


t = int(input())
results = []
while t > 0:
	n = int(input())
	if n > 0:
		if n % 2 == 0:
			temp = n // 2 - 1
			results.append(temp)
		else:
			temp = n // 2
			results.append(temp)
	else:
		results.append(0)
	t -= 1
for i in results:
	print(i)


h = []
a = int(input())
for i in range(a):
	b = int(input())
	g = b // 2
	if b % 2 == 0:
		h.append(g - 1)
	else:
		h.append(g)
for i in h:
	print(i)


t = int(input())
for a in range(t):
	n = int(input())
	if n % 2 == 1:
		result = (n - 1) / 2
		print(int(result))
	else:
		result = n / 2 - 1
		print(int(result))


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


t = int(input())
for i in range(t):
	n = int(input())
	print(max(0, n // 2 - 1) if n % 2 == 0 else max(0, n // 2))


test_cases = [int(input()) for i in range(int(input()))]
for t in test_cases:
	print((t - 1) // 2)


from sys import stdin, stdout
t = int(stdin.readline())
while t > 0:
	n = int(stdin.readline())
	stdout.write('{}\n'.format((n - 1) // 2))
	t -= 1


for _ in range(int(input())):
	N = int(input())
	Ans = 0
	if N & 1:
		Ans = int(N // 2)
	else:
		Ans = int(N // 2) - 1
	print(Ans)


from sys import stdin
import math

def solvecandies(numofcandies):
	if numofcandies % 2 != 0:
		return math.floor(numofcandies / 2)
	else:
		return int(numofcandies / 2 - 1)
counter = 0
for test in stdin:
	if counter == 0:
		counter += 1
	else:
		print(solvecandies(int(test)))


q = int(input())
for i in range(q):
	n = int(int(input()) / 2 - 0.5)
	print(n if n > 0 else 0)


a = int(input())
h = []
for i in range(0, a):
	res = 0
	x = int(input())
	if x % 2 == 0:
		res = int(x / 2) - 1
	else:
		res = int(x // 2)
	h.append(res)
print(*h, sep='\n')


num = int(input())
count = 0
for i in range(0, num):
	count = 0
	n = int(input())
	if n == 0 or n == 1 or n == 2:
		print(0)
	else:
		print(int((n - 1) / 2))


import math
n = int(input())
for _ in range(n):
	buf = int(input())
	if buf > 2 and buf % 2 != 0:
		print(buf - math.ceil(buf / 2))
	elif buf > 2 and buf % 2 == 0:
		print(buf - (math.ceil(buf / 2) + 1))
	else:
		print('0')


for _ in range(int(input())):
	n = int(input())
	print(n // 2 - 1) if n % 2 == 0 else print(n // 2)


t = int(input())
for i in range(t):
	n = int(input())
	if n > 2:
		if n % 2 == 0:
			a = n // 2 - 1
			print(a)
		else:
			b = n // 2
			print(b)
	else:
		print('0')


t = int(input())
for case in range(t):
	n = int(input())
	a = 0
	b = 0
	if n < 3:
		print('0')
	else:
		a = n // 2
		b = n % 2
		if b == 0:
			print(a - 1)
		else:
			print(a)


res = []
n = int(input())
for i in range(n):
	t = int(input())
	res.append(t)
for x in res:
	if x <= 2:
		print(0)
	elif (x - 1) % 2 == 0:
		print(divmod(x - 1, 2)[0])
	else:
		print(divmod(x, 2)[0] - 1)


test = int(input())
for i in range(0, test):
	n = int(input())
	if n == 0 or n == 1 or n == 2:
		print('0')
	else:
		if n % 2 == 0:
			ans = int(n / 2) - 1
		else:
			ans = int(n / 2)
		print(ans)


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	nt = int(stdin.readline())
	for test in range(nt):
		n = int(stdin.readline())
		stdout.write('%d\n' % ((n - 1) // 2))
	return 0
main()


T = int(input())
for t in range(T):
	n = int(input())
	print((n - 1) // 2)


a = int(input())
ans = []
for i in range(a):
	b = int(input())
	if b > 2:
		if b % 2 == 0:
			ans.append(b // 2 - 1)
		else:
			ans.append((b - 1) // 2)
	else:
		ans.append(0)
i = 0
while i < len(ans):
	if i != len(ans) - 1:
		print(ans[i])
	else:
		print(ans[i], end='')
	i += 1


import sys
num_of_test_cases = int(input())
test_cases = list(map(int, sys.stdin.readlines()))

def f(x):
	if x % 2 == 0:
		return int(x / 2 - 1)
	else:
		return int(x / 2)
results = map(f, test_cases)
for r in results:
	print(r)


for _ in range(int(input())):
	x = int(input())
	if x % 2 == 0:
		print(min(x // 2, x) - 1)
	else:
		print(min(x // 2, x))


for z in range(int(input())):
	n = int(input())
	if n <= 2:
		print(0)
	elif n % 2 != 0:
		print(n // 2)
	else:
		c = n // 2
		print(c - 1)


def solve(n):
	if n < 2:
		return 0
	if n % 2 == 0:
		result = n // 2 - 1
		return result
	return n // 2
t = int(input())
for _ in range(t):
	n = int(input())
	result = solve(n)
	print(result)


I = input
T = int(I())
for TT in range(T):
	n = int(I())
	if n <= 2:
		print(0)
	elif n % 2 == 0:
		print((n - 1) // 2)
	else:
		print(n // 2)


def distribution(n):
	return (n - 1) // 2

def problem_A():
	print(distribution(int(input())))
s = 'abcdefghijklmnopqrstuvwxyz'

def cons_str(n, b):
	a = s[:b]
	ans = ''
	while n > b:
		ans += a
		n -= b
	ans += a[:n]
	return ans

def problem_B():
	(n, a, b) = list(map(int, input().split()))
	print(cons_str(n, b))

def comp_teams(a):
	if len(a) < 2:
		return 0
	s = len(set(a))
	if s == len(a):
		return 1
	a.sort()
	t = 0
	temp = 1
	for i in range(1, len(a)):
		if a[i] == a[i - 1]:
			temp += 1
		else:
			if t < temp:
				t = temp
			temp = 1
	if t < temp:
		t = temp
	if s <= t - 1:
		return s
	if s == t:
		return s - 1
	else:
		return t

def problem_C():
	l = int(input())
	a = list(map(int, input().split()))
	print(comp_teams(a))

def antisudoku(a):
	for i in range(9):
		for j in range(9):
			if a[i][j] == '2':
				a[i][j] = '1'
	return a

def problem_D():
	a = []
	for _ in range(9):
		a.append(list(input()))
	b = antisudoku(a)
	for i in range(9):
		print(''.join(b[i]))

def three_block_palindrome(s):
	a = []
	b = []
	c = []
	l = len(s)
	for _ in range(l):
		a = []
		for _ in range(l + 1):
			a.append([0] * 26)
	l += 1
	for i in range(1, l):
		k = s[i - 1] - 1
		for j in range(26):
			a[i][j] = a[i - 1][j]
		a[i][k] += 1
	maxlength = 0
	for i in range(l):
		for j in range(i, l):
			maxa = 0
			maxb = 0
			for k in range(26):
				if a[l - 1][k] - a[j][k] > a[i][k]:
					if maxa < a[i][k]:
						maxa = a[i][k]
				elif maxa < a[l - 1][k] - a[j][k]:
					maxa = a[l - 1][k] - a[j][k]
				if maxb < a[j][k] - a[i][k]:
					maxb = a[j][k] - a[i][k]
			if maxlength < 2 * maxa + maxb:
				maxlength = 2 * maxa + maxb
	return maxlength

def problem_E1():
	l = int(input())
	s = list(map(int, input().split()))
	print(three_block_palindrome(s))
cases = int(input())
for _ in range(cases):
	problem_A()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 1:
		print(n - int(math.ceil(n / 2)))
	else:
		print(n - int(n / 2) - 1)


try:
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
except:
	pass


from collections import defaultdict
from collections import Counter
from string import ascii_lowercase
import math
from sys import setrecursionlimit as srl
srl(2 * 10 ** 6)

def solve(n):
	if n == 1:
		return 0
	if n == 2:
		return 0
	return (n - 1) // 2
t = int(input())
while t:
	n = int(input())
	print(solve(n))
	t -= 1


from sys import stdin, exit
input = stdin.readline

def i():
	return input()

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

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

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

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	n = ii()
	c = n // 2
	if n % 2 == 0:
		c -= 1
	print(c)


n = int(input())
for i in range(n):
	num = int(input())
	if num % 2 == 0 and num != 0:
		c = num / 2 - 1
	elif num > 1:
		c = num // 2
	else:
		c = 0
	print(int(c))


n_t = int(input())
for t in range(n_t):
	print(int((int(input()) - 1) / 2))


nbT = int(input())
for i in range(nbT):
	l = int(input())
	print(int((l - 1) / 2))


n = int(input())
for j in range(n):
	k = int(input())
	if k == 1 or k == 2:
		print(0)
	elif k % 2 == 0:
		print(k // 2 - 1)
	else:
		print(k // 2)


t = int(input())
for q in range(t):
	n = int(input())
	if n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


import math as m
n = int(input())
for i in range(n):
	n1 = int(input())
	if n1 <= 2:
		print(0)
	elif n1 % 2 == 0:
		print(m.floor(n1 / 2 - 1))
	else:
		print(m.floor(n1 / 2))


testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(0)
		continue
	if n == 3:
		print(1)
		continue
	if n & 1 == 0:
		half = n // 2
		print(n - half - 1)
		continue
	if n & 1 == 1:
		half = n // 2 + 1
		print(n - half)


t = int(input())
while t:
	n = int(input())
	if n == 1 or n == 2:
		print('0')
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
	t -= 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = n / 2
	if round(a) == n / 2:
		print(int(n / 2 - 1))
	else:
		print(int(math.floor(n / 2)))


t = int(input(''))
while t > 0:
	n = int(input(''))
	res = n // 2 + 1
	print(n - res)
	t -= 1


t = int(input())
for t1 in range(0, t):
	n = int(input())
	if n % 2 == 0:
		k = n // 2
		print(k - 1)
	else:
		k = n // 2
		print(k)


N = int(input())
for i in range(N):
	num = int(input())
	if num % 2 == 0:
		print(round(num / 2 - 1))
	else:
		print(round((num - 1) / 2))


n = int(input())
for i in range(n):
	c = int(input())
	if c % 2 == 1:
		print(int(c / 2))
	else:
		print(int(c / 2) - 1)


import math

def waysOfDistribution(n):
	return math.ceil(n / 2) - 1
for _ in range(int(input())):
	print(waysOfDistribution(int(input())))


t = int(input())
while t > 0:
	n = int(input())
	ans = int(n / 2)
	if n % 2 == 0:
		print('{}'.format(ans - 1))
	else:
		print(ans)
	t -= 1


def f(n):
	if n % 2 == 1:
		return n // 2
	else:
		return n // 2 - 1
lst = []
for i in range(int(input())):
	lst.append(f(int(input())))
for i in lst:
	print(i)


import os, sys
if os.path.exists('inp.txt'):
	sys.stdin = open('inp.txt', 'r')

def _():
	return sys.stdin.readline()

def __():
	return sys.stdin.readline().split()
maxn = 100005
q = int(_())
for id in range(q):
	n = int(_())
	if n >= 3:
		print((n - 1) // 2)
	else:
		print(0)


t = int(input())
for t1 in range(t):
	n = int(input())
	print((n - 1) // 2)


T = int(input())
for z in range(T):
	chocolates = int(input())
	ans = chocolates - (chocolates // 2 + 1)
	print(ans)


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
for i in l:
	print((i - 1) // 2)


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


import math
for i in range(int(input())):
	n = int(input())
	print((n - 1) // 2)


testes = int(input())
for t in range(testes):
	n = int(input())
	div = n // 2
	if n % 2 == 0:
		div -= 1
	if div <= 0:
		print(0)
	else:
		print(div)


def cases(n):
	if n > 2 and n % 2 == 0:
		c = n // 2 - 1
	elif n > 2 and n % 2 != 0:
		c = n // 2
	else:
		c = 0
	return c
t = int(input())
for i in range(t):
	n = int(input())
	print(cases(n))


n = int(input())
for i in range(n):
	k = int(input())
	print((k - 1) // 2)


t = int(input())
while t:
	n = int(input())
	if n % 2:
		k = n // 2
	else:
		k = n // 2 - 1
	print(min(k, n - k))
	t -= 1


for i in range(0, int(input())):
	n = int(input())
	if n < 2:
		print('0')
	elif n % 2 != 0:
		print(n // 2)
	else:
		print(n // 2 - 1)


import sys
for __ in range(int(sys.stdin.readline())):
	candies = int(sys.stdin.readline())
	if candies < 3:
		print(0)
	elif candies % 2 == 0:
		candies = candies // 2 - 1
		sys.stdout.write(str(candies) + '\n')
	else:
		candies = candies // 2
		sys.stdout.write(str(candies) + '\n')


import sys
import math
from statistics import mean
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for i in range(t):
	n = inp()
	if n == 1 or n == 2:
		print(0)
	elif n % 2 != 0:
		print(int(n / 2))
	else:
		print(int(n / 2) - 1)


import math
import sys
import re
import itertools
import pprint
import collections
import copy
(rs, ri, rai, raf) = (input, lambda : int(input()), lambda : list(map(int, input().split())), lambda : list(map(float, input().split())))

def pai(x):
	return print(' '.join(map(str, x)))
t = ri()
for i in range(t):
	n = ri()
	if n < 3:
		print(0)
	else:
		print((n + 1) // 2 - 1)


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2 + 1
	if x == 0 or n - x == 0:
		print(0)
	else:
		print(n - x)


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n <= 2:
		print(0)
	else:
		d = math.ceil(n / 2) - 1
		print(d)


for _ in range(int(input())):
	candies = int(input())
	ways = (candies - 1) // 2
	print(ways)


import sys
input = sys.stdin.readline
tc = int(input())
for _ in range(tc):
	n = int(input())
	if n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


n = int(input())
for i in range(n):
	s = int(input())
	print(s // 2 - 1 * (s % 2 == 0))


n = int(input())
a = []
for i in range(n):
	j = int(input())
	if j % 2 == 0:
		a.append(j // 2 - 1)
	else:
		a.append(j // 2)
for i in a:
	print(i)


n = int(input())
lst = []
for i in range(n):
	a = int(input())
	if a % 2 == 0 and a != 0:
		lst.append(int(a / 2) - 1)
	else:
		lst.append(int(a / 2))
print(*lst, sep='\n')


import math
num_test_cases = int(input())
for test in range(num_test_cases):
	num_candies = int(input())
	if num_candies == 1 or num_candies == 2:
		print(0)
	else:
		num_ways = math.floor((num_candies - 1) / 2)
		print(num_ways)


t = int(input())
n = [input() for i in range(t)]
for i in n:
	if int(i) < 3:
		print(0)
		continue
	elif int(i) % 2 == 0:
		print(int(int(i) / 2 - 1))
	elif int(i) % 2 != 0:
		print(int(int(i) // 2))


t = int(input())
for case in range(t):
	k = int(input())
	print((k - 1) // 2)


tx = int(input())
for i in range(tx):
	n = int(input())
	print(int((n - 1) / 2))


try:
	t = int(input())
	while t:
		n = int(input())
		if n < 3:
			print('0')
			continue
		else:
			print((n - 1) // 2)
		t = t - 1
except:
	pass


n = int(input())
lst = []
for i in range(n):
	x = int(input())
	lst.append(x)
for i in lst:
	if i in (0, 1, 2):
		print(0)
	elif i % 2 == 0:
		print(i // 2 - 1)
	else:
		print(i // 2)


import math
n = int(input())
for i in range(n):
	a = int(input())
	if a % 2 == 0:
		s = a // 2
		print(s - 1)
	elif a % 2 != 0:
		s = a / 2
		s = math.floor(s)
		print(s)


t = int(input())
for _ in range(t):
	a = int(input())
	f = (a - 1) // 2
	print(max(0, f))


a = int(input())
b = []
for i in range(a):
	temp = int(input())
	new = int((temp - 1) / 2)
	b.append(new)
for i in range(0, a):
	print(b[i])


n = int(input())
for i in range(n):
	a = int(input())
	if a <= 2:
		print(0)
		continue
	if a % 2 == 0:
		print(int(a / 2) - 1)
	else:
		print(int(a / 2))


n = int(input())
j = 0
pole = []
k = 0
while j < n:
	k = int(input())
	pole.append(k)
	j += 1
for i in range(0, n):
	if pole[i] == 1 or pole[i] == 0:
		print(0)
	elif pole[i] % 2 == 0:
		j = pole[i] // 2 - 1
		print(j)
	elif pole[i] % 2 == 1:
		k = (pole[i] - 1) // 2
		print(k)


import math
n = int(input())
for i in range(n):
	k = int(input())
	if k % 2 == 0:
		print(math.floor(k // 2) - 1)
	else:
		print(math.floor(k // 2))


t = int(input())
for _ in range(t):
	n = int(input())
	ans = n - (int(n / 2) + 1)
	print(ans)


m = int(input())
ls = []
sum = []
for i in range(m):
	n = int(input())
	ls.append(n)
for i in range(len(ls)):
	ls1 = []
	if ls[i] % 2 == 0:
		sum2 = int((ls[i] - 2) / 2)
	if ls[i] % 2 == 1:
		sum2 = int((ls[i] - 3) / 2 + 1)
	sum.append(sum2)
for i in range(len(sum)):
	print(sum[i])


def solution(num):
	return (num - 1) // 2
casesNum = int(input())
cases = []
for i in range(casesNum):
	cases.append(int(input()))
for case in cases:
	print(solution(case))


import math

def n_even(n):
	return n / 2 - 1

def n_odd(n):
	return math.floor(n / 2)
t = int(input())
for i in range(t):
	n = int(input())
	if n <= 2:
		print(0)
	elif n % 2 == 0:
		print(int(n_even(n)))
	else:
		print(int(n_odd(n)))


gi = lambda : list(map(int, input().split()))
for _ in range(gi()[0]):
	(n,) = gi()
	print(max(0, n // 2 - (1 - n % 2)))


import sys
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 7
for _ in range(int(ri())):
	n = int(ri())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


T = int(input())
while T:
	n = int(input())
	c = (n + 1) // 2
	print(max(c - 1, 0))
	T = T - 1


t = int(input())
total = []
new_total = []
for i in range(t):
	total.append(int(input()))
for n in range(t):
	if total[n] == 0 or total[n] == 1 or total[n] == 2:
		print(int(0))
	elif total[n] % 2 == 0:
		print(int(total[n] / 2 - 1))
	else:
		print(int((total[n] - 1) / 2))


from math import floor
for _ in range(int(input())):
	n = int(input())
	if n & 1:
		print(floor(n / 2))
	else:
		print(floor(n / 2) - 1)


import math
i = int(input())
while i != 0:
	x = int(input())
	if x < 3:
		print(0)
		i -= 1
	elif x % 2 != 0:
		print(int((x - 1) / 2))
		i -= 1
	else:
		print(int(math.floor((x - 1) / 2)))
		i -= 1


T = int(input())
for i in range(T):
	n = int(input())
	print(n - 1 - n // 2)


T = int(input())
for t in range(T):
	n = int(input())
	if n < 3:
		print(0)
	else:
		print((n - 1) // 2)


num = int(input())
for x in range(0, num):
	a = int(input())
	if a % 2 == 0:
		print(int(a / 2) - 1)
	else:
		print(int(a / 2))


MI = lambda : map(int, input().split())
LI = lambda : list(MI())
II = lambda : int(input())
for _ in range(II()):
	n = II()
	ans = n >> 1 if n & 1 else (n >> 1) - 1
	print(ans)


n = int(input())
for i in range(n):
	k = int(input())
	if k < 3:
		print(0)
	else:
		print((k - 1) // 2)


def Candies_and_Two_Sisters(n):
	if n % 2 != 0:
		ans = n // 2
	else:
		ans = n // 2 - 1
	return ans
t = input()
for i in range(0, int(t)):
	n = input()
	print(Candies_and_Two_Sisters(int(n)))


import math
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	print(math.ceil(n / 2) - 1)


T = int(input())
while T > 0:
	n = int(input())
	print((n - 1) // 2)
	T -= 1


from math import *
t = int(input())
output = []
for _ in range(t):
	n = int(input())
	output.append(str(floor((n - 1) / 2)))
for i in output:
	print(i)


tests = int(input())
for i in range(tests):
	candies = int(input())
	if candies < 3:
		print(0)
	elif candies % 2 == 0:
		print(int(candies / 2 - 1))
	else:
		print(candies // 2)


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	num = int(input())
	if num % 2 == 0:
		print(num // 2 - 1)
	else:
		print(num // 2)


n = int(input())
ca = []
for i in range(n):
	ca.append(int(input()))
for c in ca:
	if c == 1 or c == 2:
		print(0)
	else:
		a = c // 2 + 1
		s = c - a
		print(s)


from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect

def solve(n):
	if n & 1:
		return n // 2
	else:
		return n // 2 - 1
for _ in range(int(input())):
	inf = list(map(int, input().split()))
	n = inf[0]
	print(solve(n))


import math
t = int(input())
for _ in range(t):
	a = int(input())
	if a < 3:
		print(0)
	else:
		print(math.ceil(a / 2) - 1)


Testcases = int(input())
for x in range(Testcases):
	N = int(input())
	if N % 2 == 0:
		m = N // 2 - 1
	else:
		m = (N - 1) // 2
	print(m)


t = int(input())
for qwe in range(t):
	n = int(input())
	print((n + 1) // 2 - 1)


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

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

def fi():
	return float(stdin.readline())

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

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

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

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
res = ['YES', 'NO']

def main():
	n = ii() - 1
	print(n // 2)
	return
for _ in range(ii()):
	main()


t = int(input())
for tt in range(0, t):
	n = int(input())
	ways = 0
	if n % 2 == 0:
		ways = n // 2 - 1
	else:
		ways = n // 2
	print(ways)


t = int(input())
while t > 0:
	num = int(input())
	print((num - 1) // 2)
	t = t - 1


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		print((n - 1) // 2)
main()


class Solution:

	def counts(self, n):
		return (n - 1) // 2

	def solve(self):
		t = int(input())
		for i in range(t):
			n = int(input())
			print(self.counts(n))
Solution().solve()


import math as m
for _ in range(int(input())):
	n = int(input())
	ans = m.ceil(n / 2) - 1
	print(ans)


import sys
input = sys.stdin.readline

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

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

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

def getStr():
	return input().strip()
t = getInt()
for _ in range(t):
	n = getInt()
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


n = int(input())
for i in range(n):
	x = 0
	a = int(input())
	x += (a - 1) // 2
	print(x)
	x = 0


import math
testcases = int(input())
l = []
for i in range(testcases):
	n = int(input())
	l.append(n)
for n in l:
	print(math.ceil(n / 2 - 1))


n = int(input())
lista = []
for i in range(n):
	lista.append(int(input()))
for i in lista:
	if i % 2 == 0:
		print(i // 2 - 1)
	else:
		print(i // 2)


from sys import stdin
t = int(stdin.readline())
for _ in range(0, t):
	n = int(stdin.readline())
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


t = int(input())
for _ in range(t):
	k = int(input())
	if k % 2 == 0:
		print(k // 2 - 1)
	else:
		print(k // 2)


from sys import stdin
p = int(stdin.readline())
for i in range(p):
	n = int(stdin.readline())
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


t = int(input())
for x in range(t):
	n = int(input())
	r = n % 2
	if r == 1:
		g = n // 2
	else:
		g = n // 2 - 1
	print(g)


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	count = 0
	if n < 3:
		print(0)
	else:
		n -= 3
		count = n // 2 + 1
		print(count)


t = int(input())
for _ in range(t):
	num_candies = int(input())
	ways = 0
	i = 1
	j = num_candies - 1
	print(j // 2)


a = int(input())
for i in range(a):
	b = int(input())
	if b % 2 == 0:
		c = b // 2 - 1
	else:
		c = b // 2
	print(c)


t = int(input())
i = 0
import math
while i < t:
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	else:
		a = math.ceil(n / 2)
		if n % 2 == 0:
			a = a + 1
		print(n - a)
	i = i + 1


import math

def candies_and_two_sisters(n):
	a = math.floor(n / 2) + 1
	total = n - a
	print(total)
t = int(input())
for i in range(0, t):
	n = int(input())
	candies_and_two_sisters(n)


t = int(input())
for test in range(t):
	n = int(input())
	if n is 1:
		print(int(0))
	elif n % 2 == 0:
		print(int(n / 2 - 1))
	else:
		print(int(n / 2))


x = int(input())
for i in range(x):
	y = int(input())
	if y % 2 != 0:
		print(int(y // 2))
	elif y % 2 == 0:
		print(int(y / 2) - 1)


for _ in ' ' * int(input()):
	print(-(-int(input()) // 2) - 1)


t = int(input())
for x in range(t):
	count = 0
	n = int(input())
	if n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


t = int(input())
i = 0
while i < t:
	num = int(input())
	x = num // 2
	if num % 2 == 0:
		print(x - 1)
	else:
		print(x)
	i += 1


length = input()
for x in range(int(length)):
	num = int(input())
	if num < 3:
		print(0)
	else:
		div = num / 2
		if div - int(div) == 0.5:
			print(int(num / 2))
		else:
			print(int(num / 2) - 1)


for case in range(int(input())):
	n = int(input())
	print(n - (n + 2) // 2)


for _ in range(int(input())):
	current = int(input())
	if current < 3:
		print('0')
	elif current % 2 != 0:
		print(current // 2)
	else:
		print(current // 2 - 1)


import re
n = int(input())
nums = []
for i in range(n):
	i = int(input())
	nums = nums + [i]
for j in nums:
	if j == 0 or j == 1:
		print('0')
	elif j % 2 != 0:
		print(int((j - 1) / 2))
	elif j % 2 == 0:
		print(int((j - 2) / 2))


from heapq import *
from collections import *
import os
import sys
from io import BytesIO, IOBase
import math
ins = lambda : [int(x) for x in input()]
t = lambda : int(input())
inps = lambda : [int(x) for x in input().split()]

def main():
	for i in range(t()):
		n = t()
		if n < 3:
			print(0)
		elif n % 2 & 1:
			print(n // 2)
		else:
			print(n // 2 - 1)
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
t = int(input())
for i in range(t):
	t = int(input())
	if t % 2 == 0:
		print(t // 2 - 1)
	else:
		print(math.floor(t / 2))


t = int(input())
for q in range(t):
	n = int(input())
	print(max((n - 1) // 2, 0))


t = int(input())
for g in range(t):
	n = int(input())
	if n % 2 == 0:
		ans = n // 2 - 1
	else:
		ans = (n - 1) // 2
	print(ans)


try:
	while True:
		t = int(input())
		for i in range(t):
			num = int(input())
			if num % 2 != 0:
				res = num // 2
			else:
				res = num // 2 - 1
			print(res)
except EOFError:
	pass


import math
t = int(input())
for i in range(t):
	n = int(input())
	x = math.ceil(n / 2)
	print(x - 1)


import math
t = int(input())
inp = []
for i in range(t):
	n = int(input())
	inp.append(n)
for item in inp:
	if item % 2 == 0:
		print(int(item / 2 - 1))
	else:
		result = int(math.floor(item / 2))
		print(result)


import math
c = int(input())
for i in range(c):
	N = int(input())
	if N % 2 == 0:
		a = N / 2 + 1
	else:
		a = math.ceil(N / 2)
	b = N - a
	if b < 0:
		b = 0
	print(int(b))


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	candies = math.ceil(n / 2 - 1)
	print(candies)


n = int(input())
for i in range(n):
	s = int(input())
	if s % 2 == 0:
		print(int(s / 2 - 1))
	else:
		print(int(s / 2 - 0.5))


import sys
input = sys.stdin.buffer.readline

def solution():
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
for _ in range(int(input())):
	solution()


num = int(input())
candies = []
for i in range(num):
	c = int(input())
	candies.append(c)
for c in candies:
	divide = int(c / 2) + 1
	print(c - divide)


A = []
T = int(input())
for i in range(T):
	A.append(int(input()))
for i in A:
	print((i - 1) // 2)


def a():
	n = int(input())
	ways = n - (n // 2 + 1)
	print(ways)
t = int(input())
for i in range(t):
	a()


import sys
a = int(input())
for i in range(a):
	x = int(input())
	if x / 2 == x // 2:
		print(x // 2 - 1)
	else:
		print(x // 2)


from math import floor
for t in range(int(input())):
	n = int(input())
	if n == 2 or n == 1:
		print(0)
	elif n % 2 == 0:
		print(int(n / 2 - 1))
	else:
		print(floor(n / 2))


T = int(input())
res = []
for _ in range(T):
	n = int(input())
	if n & 1:
		res.append(n // 2)
	else:
		res.append(n // 2 - 1)
for i in range(T):
	print(res[i])


i = int(input())
c = 0
collect = []
while c < i:
	x = int(input())
	if x < 2:
		y = 0
	elif x % 2 != 0:
		z = x // 2 + 1
		y = z - 1
	else:
		z = x // 2
		y = z - 1
	collect.append(y)
	c += 1
for p in collect:
	print(p)


s = int(input())
for i in range(0, s):
	n = int(input())
	if n == 1 or n == 2 or n == 0:
		print('0')
	elif n % 2 == 0:
		ans = n // 2 - 1
		print(ans)
	else:
		ans = n // 2
		print(ans)


t = int(input())
for i in range(t):
	c = int(input())
	if c < 3:
		print(0)
		continue
	if c % 2 == 0:
		print(int(c / 2) - 1)
	else:
		print(int(c // 2))


for _ in [0] * int(input()):
	N = int(input())
	print((N - 1) // 2)


def solve():
	times = int(input())
	for i in range(times):
		num = int(input())
		if num > 2:
			if num % 2 == 0:
				print(num // 2 - 1)
				continue
			elif num % 2 == 1:
				print(num // 2)
				continue
		print('0')
solve()


from math import ceil
x = int(input())
for i in range(x):
	y = int(input())
	z = int(ceil(y / 2)) - 1
	print(z)


test_cases = int(input())
for z in range(test_cases):
	n = int(input())
	if n % 2 == 0:
		print((n - 1) // 2)
	else:
		print(n // 2)


from collections import defaultdict
import heapq
import copy
import sys
stream = sys.stdin
t = int(stream.readline())
for n in stream:
	n = int(n)
	if n % 2 == 0:
		n -= 1
	print(n // 2)


n = int(input())
while n > 0:
	c = int(input())
	res = (c + 1) // 2 - 1
	print(res)
	n -= 1


def check(n):
	if n <= 2:
		return 0
	if n % 2 == 0:
		return n // 2 - 1
	return n // 2
t = int(input())
while t:
	n = int(input())
	print(check(n))
	t -= 1


def calc(n):
	if n == 2:
		print('0')
	else:
		p = (n - 1) // 2
		print(p)
t = int(input())
if 1 <= t <= 10 ** 4:
	for i in range(t):
		n = int(input())
		if 1 <= n <= 2 * 10 ** 9:
			calc(n)


def integer(array):
	for i in range(len(array)):
		array[i] = int(array[i])
	return array
N = int(input())
inputs = []
for i in range(N):
	inputs.append(integer(str(input()).split(' ')))

def candy(n):
	if n % 2 == 0:
		return int(n / 2) - 1
	else:
		return int((n - 1) / 2)
for i in inputs:
	print(candy(i[0]))


cases = int(input())
for _ in range(cases):
	num = int(input())
	print((num - 1) // 2)


import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(max(0, n // 2 - 1))
	else:
		print(n // 2)


t = int(input())
for j in range(t):
	n = int(input())
	if n == 1:
		k = 0
	elif n % 2 == 0:
		k = n / 2 - 1
	elif n % 2 == 1:
		k = (n - 1) / 2
	print(int(k))


for j in range(int(input())):
	l = int(input())
	print((l - 1) // 2)


t = int(input())
for i in range(t):
	x = int(input())
	print((x - 1) // 2)


t = int(input())
i = 0
a = []
while i < t:
	li = int(input())
	a.append(li)
	i = i + 1
j = 0
while j < t:
	if a[j] % 2 == 0:
		fi = int(a[j] / 2 - 1)
		print(fi)
	else:
		fi = int(a[j] / 2)
		print(fi)
	j = j + 1


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
		continue
	else:
		x = n // 2 + 1
	print(n - x)


t = int(input())
for i in range(0, t):
	num = int(input())
	if num % 2 == 1:
		print(int((num - 1) / 2))
	else:
		print(int((num - 2) / 2))


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


import sys
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

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

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(N):
	if N % 2 == 0:
		N -= 1
	return N // 2

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		print(slv(N))
main()


t = int(input())
if t / 10000 > 1 or t < 1:
	exit()
out = []
for _ in range(t):
	n = int(input())
	if n < 1 or n > 2 * 10 ** 9:
		exit()
	if n % 2 == 0:
		out.append(int(n / 2 - 1))
	else:
		out.append(int((n - 1) / 2))
while out:
	print(out.pop(0))


from collections import defaultdict
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations

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

def iinput():
	return int(input())

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

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())

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)))
for _ in range(iinput()):
	n = iinput()
	print(n // 2 - 1 if n % 2 == 0 else n // 2)


import sys
import math

def solve():
	n = int(input())
	if n & 1:
		print(n // 2)
	else:
		print(n // 2 - 1)
test_cases = int(input())
for _ in range(test_cases):
	solve()


def solve(n):
	add = -1 if not n % 2 else 0
	return n // 2 + add
t = int(input())
for i in range(t):
	n = int(input())
	print(solve(n))


allInputs = []
test = int(input())
for x in range(0, test):
	dummy = int(input())
	allInputs.append(dummy)
for x in allInputs:
	if x % 2 == 0:
		print(int(x / 2) - 1)
	else:
		print(int(x / 2))


def ab():
	d = int(input())
	if d == 1 or d == 2:
		print(0)
		return
	if d % 2 == 0:
		d = d - 1
	print(d // 2)
for i in range(0, int(input())):
	ab()


def numways(n):
	return n // 2 if n % 2 == 1 else n // 2 - 1
t = int(input())
for i in range(t):
	n = int(input())
	print(numways(n))


testcases = int(input())
for i in range(testcases):
	n = int(input())
	print((n - 1) // 2)


for _ in range(int(input())):
	N = int(input())
	if not N % 2:
		N -= 1
	answer = N // 2
	print(answer if answer > 0 else 0)


n = int(input())
l = list()
for i in range(n):
	l.append(int(input()))
for i in l:
	if i < 3:
		print('0')
	elif i % 2 == 0:
		print(int(i / 2 - 1))
	else:
		print(int(i / 2))


nn = int(input())
tot = 0
tot_l = []
for _ in range(nn):
	test = int(input())
	if test % 2 == 0:
		tot_l.append(test // 2 - 1)
	else:
		tot_l.append(test // 2)
for _ in tot_l:
	print(_)


def f(x):
	if x % 2 == 0:
		return x // 2 - 1
	else:
		return x // 2
t = int(input())
for i in range(0, t):
	n = int(input())
	print(f(n))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def solve(n):
	return n * (n + 1) // 2
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


import sys
cases = int(sys.stdin.readline())
for i in range(cases):
	curr = int(sys.stdin.readline())
	if curr < 3:
		print(0)
	elif curr % 2 == 0:
		print(curr // 2 - 1)
	else:
		print(curr // 2)


cases = int(input())
ans = []
while cases:
	cases -= 1
	n = int(input())
	if n == 0:
		ans.append(0)
	elif n % 2 == 0:
		ans.append(n // 2 - 1)
	else:
		ans.append(n // 2)
for a in ans:
	print(a)


import math

def solve():
	n = int(input())
	sol = 0
	if math.ceil((n + 1) / 2) < n:
		sol = n - math.ceil((n + 1) / 2)
	print(sol)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


n = input()
n = int(n)
while n > 0:
	k = input()
	k = int(k)
	if k in [0, 1, 2]:
		print(0)
	else:
		min_a = k // 2 + 1
		k -= min_a
		print(k)
	n -= 1


q = int(input())
for k in range(q):
	r = int(input())
	print((r - 1) // 2)


import sys
input = sys.stdin.buffer.readline

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

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	n = int(input())
	print(n // 2 - 1) if n % 2 == 0 else print(n // 2)


t = int(input())
for i in range(t):
	n = int(input())
	if n < 3:
		print(0)
	else:
		ot = n // 2
		if n % 2 == 0:
			print(ot - 1)
		else:
			print(ot)


for _ in range(int(input())):
	candies = int(input())
	if candies < 3:
		print(0)
	else:
		print(candies // 2) if candies & 1 == 1 else print(candies // 2 - 1)


def candies(n):
	if n % 2 == 0:
		return int(n / 2 - 1)
	else:
		return int(n / 2)
test = int(input())
for i in range(test):
	n = int(input())
	print(candies(n))


N = int(input())
data = []
for i in range(N):
	data.append(int(input()))
for i in range(N):
	print(data[i] - data[i] // 2 - 1)


a = int(input())
for i in range(a):
	b = int(input())
	count = 0
	if b < 3:
		print(0)
	elif b % 2 == 1:
		print(b // 2)
	else:
		print(b // 2 - 1)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	x = int(input()) - 1
	print(x // 2)


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	result = N // 2
	if not N % 2:
		result -= 1
	print(result)


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


no = int(input())
res = []
for i in range(no):
	candies = int(input())
	count = 0
	if candies % 2 == 0:
		res.append(candies // 2 - 1)
	elif candies % 2 != 0:
		res.append(candies // 2)
for i in res:
	print(i)


def sol(n):
	if n <= 2:
		return 0
	elif n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2
for _ in range(int(input())):
	print(sol(int(input())))


n = int(input())
for x in range(n):
	n2 = int(input())
	if n2 > 2:
		if n2 % 2 == 0:
			print(n2 // 2 - 1)
		else:
			print(n2 // 2)
	else:
		print(0)


def main(_data):
	if _data < 3:
		return 0
	if _data % 2 == 0:
		return int(_data / 2 - 1)
	else:
		return int(_data // 2)
t = int(input())
answer = []
for i in range(t):
	data = input()
	answer.append(main(int(data)))
for i in answer:
	print(i)


q = int(input())
for i in range(q):
	n = int(input())
	count = 0
	if n % 2 == 0:
		a = n / 2
		count = -1
	else:
		a = int(n / 2) + 1
	count += n - a
	print(int(count))


def solve(x):
	y = x // 2
	return x - y - 1
n = int(input())
for i in range(n):
	print(solve(int(input())))


import sys
from itertools import accumulate

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	ans = (N - 1) // 2
	print(ans)


foo = int(input())
list0 = [0] * foo
for i in range(foo):
	list0[i] = int(input())
	if int(int(list0[i]) - 1) % 2 == 0:
		print(int(int(list0[i]) / 2))
	elif int(list0[i]) % 2 == 0:
		print(int(int(list0[i]) / 2) - 1)


def alice_betty(n):
	if n % 2 == 0:
		return int(n / 2) - 1
	else:
		return int(n / 2)
answers = []
t = int(input())
for i in range(t):
	n = int(input())
	answers.append(alice_betty(n))
for answer in answers:
	print(answer)


def candies(n):
	return (n - 1) // 2

def test():
	number_of_tests = int(input())
	for i in range(number_of_tests):
		n = int(input())
		output = str(candies(n))
		print(output)
	return ()
test()


t = int(input())
for i in range(t):
	n = int(input())
	if n < 3:
		print(0)
		continue
	import math
	if n % 2 == 0:
		print(int((n - 2) // 2))
	else:
		print(int(n // 2))


import sys
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


t = int(input())
l1 = []
for i in range(0, t):
	x = int(input())
	if x == 0 or x == 1 or x == 2:
		n = 0
		l1.append(n)
	elif x % 2 == 0:
		n = int(x / 2) - 1
		l1.append(n)
	else:
		n = int(x / 2)
		l1.append(n)
print(*l1, sep='\n')


t = int(input().strip())
for i in range(t):
	val = None
	n = int(input().strip())
	if n <= 2:
		val = 0
	elif n % 2 == 0:
		val = n // 2 - 1
	else:
		val = n // 2
	print(val)


t = int(input())
M = []

def fonction(n):
	if n <= 2:
		return 0
	elif n % 2 == 1:
		return n // 2
	else:
		return n // 2 - 1
for i in range(t):
	n = int(input())
	M.append(fonction(n))
for k in M:
	print(k)


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


from math import floor
t = int(input())
for l in range(t):
	n = int(input())
	k = floor(n / 2)
	if k == n / 2:
		print(int(k - 1))
	else:
		print(int(k))


t = int(input())
c = 0
l = []
for i in range(t):
	n = int(input())
	if n > 1 and n % 2 != 0:
		c = int(n / 2)
		l += str(c)
		print(int(n / 2))
	elif n == 1 or n == 0:
		print(0)
		l += [0]
	elif n % 2 == 0:
		c = int(n / 2) - 1
		l += str(c)
		print(int(n / 2) - 1)


n = int(input())
numbers = []
values = []
for x in range(n):
	numbers.append(int(input()))
for x in numbers:
	if x % 2 == 0:
		values.append(x - (x / 2 + 1))
	else:
		values.append(x - (x / 2 + 0.5))
for x in values:
	print(int(x))


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

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

def inv_mod(n):
	return pow(n, mod - 2, mod)

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

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

def val():
	return int(input().rstrip('\n'))

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

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	print(n // 2 if n & 1 else n // 2 - 1)


import math
t = int(input())
while t > 0:
	g = int(input())
	a = math.floor((g - 1) / 2)
	print(a)
	t -= 1


t = int(input())
for wer in range(t):
	n = int(input())
	print((n - 1) // 2)


T = int(input())
for t in range(T):
	s = 0
	c = int(input())
	if c <= 2:
		print(0)
		continue
	s = c - c // 2 - 1
	print(s)


t = int(input())
for tt in range(t):
	n = (int(input()) - 1) // 2
	print(n)


import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	n = int(input())
	a = n // 2 + 1
	ans = n - a
	if ans <= 0:
		print(0)
	else:
		print(ans)


x = int(input())
tests = [int(input()) for _ in range(x)]
for test in tests:
	count = 0
	if test == 0 or test == 1:
		count = 0
	elif test % 2 == 0:
		count = test / 2 - 1
	else:
		count = (test - 1) / 2
	print(int(count))


from sys import stdin, stdout
from math import sqrt, ceil, gcd, log, log10

def rl(f=int):
	return [f(x) for x in stdin.readline().split()]

def rls(f=int):
	return [f(x) for x in stdin.readlines()]
rl()
for n in rls():
	if n == 1:
		print(0)
	elif n == 2:
		print(0)
	elif n % 2:
		print(n // 2)
	else:
		print(n // 2 - 1)


def solve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
solve()


import math

def main():
	op = ''
	t = int(input())
	for i in range(t):
		n = int(input())
		a = n / 2
		if n % 2 == 0:
			op += str(int(n - a - 1)) + '\n'
		else:
			op += str(int(n - math.ceil(a))) + '\n'
	print(op)
main()


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)
t = I()
for _ in range(t):
	n = I()
	print((n - 1) // 2)


n = int(input())
for i in range(n):
	a = int(input())
	print((a - 1) // 2)


input()
while True:
	try:
		in_ = input()
	except EOFError:
		exit()
	print((int(in_) - 1) // 2)


n_cases = int(input())
inputs = list()
for i in range(n_cases):
	inputs.append(int(input()))
for i in range(n_cases):
	if inputs[i] <= 2:
		print(int(0))
	elif inputs[i] % 2 == 0:
		print(int((inputs[i] - 2) / 2))
	elif inputs[i] % 2 == 1:
		print(int((inputs[i] - 1) / 2))


t = int(input())
op = []
for x in range(0, t):
	n = int(input())
	if n < 3:
		op.append(0)
	else:
		mid = int(n / 2) + 1
		op.append(n - mid)
for x in op:
	print(x)


import math
for _ in range(int(input())):
	n = int(input())
	if n < 3:
		print('0')
	elif n == 3:
		print('1')
	elif n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


cases = int(input())
for i in range(cases):
	candies = int(input())
	if candies % 2 == 0:
		candies -= 1
	print(candies // 2)


for i in range(int(input())):
	x = 0
	k = int(input())
	if k > 2 and k % 2 == 0:
		x = k // 2 - 1
	elif k > 2 and k % 2 != 0:
		x = k // 2
	print(x)


import sys
input = sys.stdin.buffer.readline
for _ in [0] * int(input()):
	print(max((int(input()) - 1) // 2, 0))


n = int(input())
for k in range(n):
	s = int(input())
	if s % 2 == 1:
		print(s // 2)
	else:
		print(s // 2 - 1)


N = int(input())
ans = []
for i in range(N):
	num = int(input())
	flag = False
	if num % 2 == 0:
		flag = True
	a = num // 2
	if flag:
		a -= 1
	ans.append(a)
for i in range(N):
	print(ans[i])


testcase = int(input())
for i in range(testcase):
	val = int(input())
	if val < 3:
		print(0)
	elif val % 2 == 0:
		print(val // 2 - 1)
	else:
		print(val // 2)


from math import *
from bisect import bisect_left, bisect_right
from queue import Queue
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
fast_print = stdout.write
t = int(input())
for _ in range(t):
	n = int(input())
	fast_print(str(n // 2 - 1 + n % 2) + '\n')


t = int(input())
for _ in range(t):
	n = int(input())
	a = n // 2 + 1
	res = 0
	res = n - a
	if a == 1:
		print(0)
	else:
		print(res)


t = int(input())
result = []
for _ in range(t):
	n = int(input())
	result.append((n - 1) // 2)
for x in result:
	print(x)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print('0')
	elif n % 2 == 0:
		a = n // 2
		print(a - 1)
	else:
		a = n // 2
		print(a)


a = int(input())
p = 0
while p <= a - 1:
	n = int(input())
	p += 1
	if n <= 0:
		print(0)
	if n % 2 == 0:
		x = n // 2 - 1
		print(x)
	else:
		x = n // 2
		print(x)


a = int(input())
t = []
for i in range(0, a):
	s = int(input())
	if s % 2 == 0:
		t.append(s // 2 - 1)
	else:
		t.append(s // 2)
for i in t:
	print(i)


def solve(n):
	if n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2

def main():
	t = int(input())
	i = 1
	while i <= t:
		n = int(input())
		ans = solve(n)
		print(ans)
		i += 1
main()


def main():
	a = int(input())
	for i in range(a):
		b = int(input())
		if b % 2 == 0 and b > 2:
			print(int(b / 2 - 1))
			continue
		elif b % 2 != 0 and b > 2:
			print(int((b - 1) / 2))
			continue
		elif b == 2 or b == 1 or b == 0:
			print('0')
			continue
main()


def solve(c):
	if c < 2:
		return 0
	if c % 2 == 0:
		return c // 2 - 1
	else:
		return abs(c // 2 - c) - 1
for i in range(int(input())):
	print(solve(int(input())))


import collections, math, bisect, re
local = False
if local:
	file = open('input.txt', 'r')
	import time

def inp():
	if local:
		return file.readline().rstrip()
	else:
		return input().rstrip()

def ints():
	return [int(_) for _ in inp().split()]
if local:
	start = time.time()
t = int(inp())
for _ in range(1, t + 1):
	n = int(inp())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
if local:
	fin = (time.time() - start) * 1000
	print('{:.2f}'.format(fin) + 'ms')


a = int(input())
for x in range(a):
	c = 0
	a = int(input())
	b = 0
	if a != 2:
		c = a // 2
	else:
		c = 0
	if a % 2 == 0 and a != 2:
		print(c - 1)
	else:
		print(c)


t = int(input())
l = []
for i in range(t):
	n = int(input())
	if n == 1 or n == 2:
		l.append('0')
	else:
		x = n - (n // 2 + 1)
		l.append(x)
for i in range(t):
	print(l[i])


from math import ceil
from math import floor

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def find_least_diff(n):
	A = 2 * (pow(2, n / 2 - 1) - 1)
	B = -pow(2, n / 2)
	return int(abs(B - A))

def find_ways(n):
	return (n - 1) // 2

def count_possibilities(n, m):
	A = mod_expo(2, m, pow(10, 9) + 7)
	return mod_expo(A - 1, n, pow(10, 9) + 7)

def min_string(n, k, text):
	text = sorted(text)
	if text[0] == text[k - 1]:
		print(''.join((text[i] for i in range(k - 1, n))))
	else:
		print(text[k - 1])
t = 1
t = int(input())
while t:
	t = t - 1
	count = 0
	px = []
	py = []
	n = int(input())
	print(find_ways(n))


test = int(input())
i = 1
while i <= test:
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
	i += 1


def divide(n):
	return (n - 1) // 2
T = int(input())
for i in range(T):
	n = int(input())
	print(divide(n))


t = int(input())
for tests in range(t):
	n = int(input())
	print(int((n - 1) // 2))


def compute(n):
	if n in (0, 1, 2):
		return 0
	if n % 2 == 0:
		return int(n / 2 - 1)
	else:
		return int(n / 2)
testcases = int(input())
for i in range(testcases):
	print(compute(int(input())))


t = int(input())
while t:
	import math
	z = int(input())
	ans = z / 2 - 1
	print(math.ceil(ans))
	t = t - 1


def dfs(index, ans, visited, a, length):
	visited[index] = True
	if len(ans[index]) == 1:
		length[index] = a
	for i in range(len(ans[index])):
		if visited[ans[index][i]] == False:
			dfs(ans[index][i], ans, visited, a + 1, length)

def solve():
	n = list(map(int, input().split()))
	n = int(n[0])
	if n % 2 == 0:
		print(int(n / 2) - 1)
	else:
		print(int(n / 2))
t = input().split()
t = int(t[0])
for _ in range(t):
	solve()


n = int(input())
ways = []
for j in range(n):
	can = int(input())
	if can <= 2:
		ways.append(0)
	elif can % 2 == 0:
		ways.append(int(can / 2) - 1)
	elif can % 2 != 0:
		ways.append(int(can / 2))
for way in ways:
	print(way)


import math
for _ in range(int(input())):
	candies = int(input())
	print(math.floor((candies - 1) / 2))


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd, log
for _ in range(int(input())):
	n = int(input())
	if n <= 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(ceil(n / 2) - 1)


def candy_count(candy):
	count = 0
	temp = candy // 2
	return candy - temp - 1
T = int(input())
for i in range(T):
	num = int(input())
	print(candy_count(num))


n = int(input())
for i in range(n):
	j = int(input())
	h = j // 2
	if j % 2 == 0:
		h = h - 1
		print(h)
	else:
		print(h)


from math import *
for i in range(int(input())):
	print(ceil(int(input()) / 2) - 1)


for i in range(int(input())):
	x = int(input())
	y = x - 1
	print(y // 2)


I = int(input())
l = []
x = 0
for i in range(I):
	n = int(input())
	if n % 2 == 0:
		x = n // 2 - 1
	else:
		x = n // 2
	print(x)


def fac(n):
	a = 1
	i = n
	while i != 0:
		a = a * i
		i = i - 1
	return a
for t in range(int(input())):
	n = int(input())
	print((n - 1) // 2)


import math

def fun1():
	test = int(input())
	while test:
		n = int(input())
		k = math.ceil(n / 2) - 1
		if k < 0:
			print(int(0))
		else:
			print(k)
		test -= 1
fun1()


n = int(input())
li = []
lis = []
for i in range(n):
	x = int(input())
	li.append(x)
for i in range(n):
	if li[i] == 0 or li[i] == 1 or li[i] == 2:
		lis.append(0)
	elif li[i] % 2 == 0:
		li[i] = li[i] - 2
		y = li[i] / 2
		y = int(y)
		lis.append(y)
	else:
		li[i] = li[i] - 1
		z = li[i] / 2
		z = int(z)
		lis.append(z)
for i in lis:
	print(i)


for _ in range(int(input())):
	print(max(0, (int(input()) - 1) // 2))


import math
n = int(input())
c = []
for i in range(n):
	a = int(input())
	if a % 2 == 1:
		c.append(math.floor(a / 2))
	else:
		c.append(math.floor(a / 2) - 1)
for i in c:
	print(i)


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
for x in range(t):
	n = int(inp().strip())
	if n % 2:
		print(n // 2)
	else:
		print(n // 2 - 1)


m = int(input())
list = []
for i in range(0, m):
	n = int(input())
	if n % 2 == 0:
		list.append(int(n / 2) - 1)
	else:
		list.append(int(n / 2))
for i in range(0, m):
	print(list[i])


t = int(input())
for i in range(0, t):
	s = int(input())
	if s == 1 or s == 2:
		print('0')
	elif s % 2 == 0:
		print(s // 2 - 1)
	else:
		print(s // 2)


import sys
input = sys.stdin.readline
from math import *
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	print(int(ceil(n / 2)) - 1)


import sys
from collections import deque
input = lambda : sys.stdin.readline().strip()
ipnut = input
n = int(input())
for i in range(n):
	q = int(input())
	print((q - 1) // 2)


import math
n = int(input())
for e in range(n):
	a = int(input())
	if a % 2 == 0:
		print(a // 2 - 1)
	else:
		print(math.floor(a / 2))


t = int(input())
for testcase in range(t):
	n = int(input())
	if n % 2 == 0:
		print(int(n / 2) - 1)
	else:
		print(int(n / 2))


t = int(input())
count = 0
while count < t:
	count += 1
	n = int(input())
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


checker_count = int(input())
i = 0
while i < checker_count:
	n = int(input())
	if n % 2 == 1:
		print(int((n - 1) / 2))
	else:
		print(int((n - 2) / 2))
	i += 1


ways = [(int(input()) - 1) // 2 for _ in range(int(input()))]
for i in ways:
	print(i)


ceil = lambda a, b: a // b + bool(a % b)

def solve(n):
	if n == 1:
		return 0
	return ceil(n, 2) - 1
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


from sys import stdout, stdin
t = stdin.readline
f = lambda n: n // 2 if n % 2 == 1 else n // 2 - 1
for i in range(int(t())):
	stdout.write('{}\n'.format(f(int(t()))))


num = int(input())
result = []
for i in range(num):
	test = int(input())
	if test < 3:
		result.append(0)
	else:
		result.append([test // 2, test // 2 - 1][test % 2 == 0])
print(*result, sep='\n')


T = int(input())
while T:
	num = int(input())
	if num % 2 == 0:
		print(num // 2 - 1)
	else:
		print(num // 2)
	T -= 1


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		print((n - 1) // 2)
	q = int(input())
	for _ in range(q):
		solve()
main()


_ = int(input())
for q in range(_):
	inp = int(input())
	if inp == 1 or inp == 2:
		print(0)
	elif inp % 2 == 0:
		print(inp // 2 - 1)
	else:
		print(inp // 2)


a = []
for i in range(int(input())):
	a.append(int(input()))
for i in a:
	print((i - 1) // 2)


t = int(input())
testcaseList = []
for testcaseIndex in range(t):
	n = int(input())
	testcaseList.append(n)
for n in testcaseList:
	halfNumber = int(n / 2)
	if n % 2 == 0:
		answer = max([0, halfNumber - 1])
	else:
		answer = max([0, halfNumber])
	print(answer)


from math import ceil
for T in range(int(input())):
	n = int(input())
	if n < 2:
		print(0)
	else:
		x = int(ceil(n / 2))
		print(x - 1)


import math
t = int(input())
for g in range(0, t):
	n = int(input())
	if n <= 2:
		print(0)
	elif (n - 2) % 2 == 0:
		x = (n - 2) / 2
		print(int(x))
	else:
		print(int(math.ceil((n - 2) / 2)))


import sys
t = int(input())
for x in range(t):
	n = int(input())
	if n == 2:
		r = 0
	else:
		r = n // 2
		if n % 2 == 0 and r != 0:
			r = r - 1
	print(r)


def solver(arr: list) -> None:
	aux = []
	x = 0
	for i in range(len(arr)):
		if arr[i] == 1 or arr[i] == 2:
			x = 0
		else:
			x = (arr[i] - 1) // 2
		aux.append(x)
	for i in aux:
		print(i)
n = int(input())
arr = []
for i in range(n):
	x = int(input())
	arr.append(x)
solver(arr)


n = int(input())
for _ in range(n):
	x = int(input())
	print([0, [x // 2 - 1, x // 2][x % 2]][x > 2])


import math
for _ in range(int(input())):
	n = int(input())
	s = math.ceil(n / 2)
	e = n - 1
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(e - s)
	else:
		print(e - s + 1)


t = int(input())
l = []
for i in range(t):
	l.append((int(input()) + 1) // 2 - 1)
for i in l:
	print(i)


t = int(input())
r = []
for i in range(0, t):
	n = int(input())
	res = n - (n // 2 + 1)
	if res < 0:
		res = 0
	r.append(res)
for i in range(0, t):
	print(r[i])


t = int(input())
for _ in range(t):
	n = int(input())
	s = n - n // 2 - 1
	print(s)


import math as mt
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	print(mt.floor((n - 1) / 2))


import math

def result(n):
	cnt = n / 2
	cnt1 = cnt - 1
	return math.ceil(cnt1)
t = int(input())
for i in range(t):
	n = int(input())
	ans = result(n)
	print(ans)


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	for _ in range(int(input())):
		n = int(input())
		if n < 2:
			print('0')
		elif n == 2:
			print('0')
		else:
			if n % 2 == 0:
				ans = n // 2 - 1
			else:
				ans = n // 2
			print(ans)


for _ in range(int(input())):
	n = int(input())
	a = n // 2 + 1
	b = n - a
	print(b)


import math
test = int(input())
while test > 0:
	candies = input()
	l = int(candies[-1])
	cd = int(candies)
	n = l % 2
	avg = cd / 2
	if n != 0:
		ans = math.floor(avg)
		print(ans)
	else:
		ans = avg + 1
		print(int(cd - ans))
	test -= 1


for _ in range(int(input())):
	data = int(input())
	print(data // 2 if data % 2 == 1 else (data - 1) // 2)


import sys

def read_line():
	return sys.stdin.readline()

def solve(k):
	print(max(0, k // 2 - 1) if k % 2 == 0 else k // 2)
n = int(input())
for i in range(n):
	solve(int(input()))


from sys import stdin

def main():
	r = stdin.readline
	cases = int(r())
	for case in range(cases):
		n = int(r())
		if n == 1 or n == 2:
			print(0)
		else:
			print(n // 2 if n % 2 == 1 else n // 2 - 1)
main()


t = int(input())
for e in range(t):
	n = int(input())
	if n <= 2:
		print('0')
	elif n > 2 and n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


T = int(input())
for _ in range(T):
	n = int(input())
	if n % 2 == 0:
		ans = n // 2 - 1
	else:
		ans = n // 2
	ans = max(0, ans)
	print(ans)


import os
import sys
from math import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def array():
	return [int(i) for i in input().split()]
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	if n <= 2:
		print(0)
	else:
		m = n // 2 + 1
		print(n - m)


def main():
	for _ in inputt():
		(n,) = inputi()
		print((n - 1) // 2)
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict, deque
import re, copy, operator, cmath
import calendar
import sys, io, os, builtins
sys.setrecursionlimit(1000)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.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(io.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):
	sys.stdout.write(kwargs.pop('split', ' ').join(map(str, args)))
	sys.stdout.write(kwargs.pop('end', '\n'))
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda k=int: map(k, inputs())
inputf = lambda : inputi(float)
inputl = lambda t=0, k=inputi: map(list, (k() for _ in range(t))) if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n > 2:
		if n % 2 == 1:
			(i, j) = (n // 2 + 1, n // 2)
			print(j)
		else:
			(i, j) = (n // 2 + 1, n // 2 - 1)
			print(j)
	else:
		print(0)


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, inp().strip().split())

def LI():
	return list(map(int, inp().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	l = []
	for _ in range(t):
		n = I()
		if n == 1 or n == 2:
			print(0)
		elif n % 2 != 0:
			print(n // 2)
		else:
			print(n // 2 - 1)
main()


from sys import stdin, stdout
T = int(stdin.readline())
for i in range(T):
	N = int(stdin.readline())
	res = (N - 1) // 2
	stdout.write(str(res) + '\n')


import math
n = int(input())
res = []
for i in range(n):
	k = int(input())
	t = math.floor(k / 2)
	if k % 2 == 0:
		t -= 1
	res.append(t)
for i in res:
	print(i)


t = int(input())
ma = []
for i in range(t):
	n = int(input())
	if n == 1:
		ma.append(0)
	elif n % 2 == 1:
		ma.append(n // 2)
	else:
		ma.append(n // 2 - 1)
for i in ma:
	print(i)


w = int(input())
ouns = []
for i in range(w):
	e = int(input())
	cound = 0
	if e > 2:
		if e % 2 == 0:
			cound = e // 2 - 1
		else:
			cound = e // 2
	ouns += [cound]
for k in range(w):
	print(ouns[k])


import math
for x in range(int(input())):
	n = int(input())
	tmp = n
	if n < 3:
		print(0)
	else:
		n = n / 2
		n = math.ceil(n)
		if tmp / 2 == math.ceil(n):
			print(tmp - n - 1)
		else:
			print(tmp - n)


n = int(input())
for i in range(n):
	tmp = int(input())
	print((tmp - 1) // 2)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	res = n // 2
	if n % 2 == 0:
		res -= 1
	ans.append(res)
print(*ans, sep='\n')


n = int(input())
for i in range(n):
	print(int(input()) - 1 >> 1)


t = int(input())
for u in range(t):
	n = int(input())
	x = max(n // 2, n - n // 2)
	if n % 2 == 0:
		print(n - x - 1)
	else:
		print(n - x)


a = input()
a = int(a)
for i in range(a):
	b = input()
	b = int(b)
	ans = (b + 1) // 2 - 1
	if ans < 0:
		ans = 0
	print(ans)


t = int(input())
for _ in range(t):
	print((int(input()) - 1) // 2)


t = int(input())
for i in range(t):
	a = int(input())
	if not a % 2:
		print(a // 2 - 1)
	else:
		print(a // 2)


for _ in range(int(input())):
	a = int(input())
	if a % 2 == 1:
		print(a // 2)
	else:
		print((a - 1) // 2)


from math import floor
t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	if n % 2 == 1:
		ans = int(floor(n / 2))
	else:
		ans = int(n / 2 - 1)
	print(ans)


from math import floor
T = int(input())
l = []
for i in range(T):
	l.append(int(input()))
for i in l:
	if i % 2 == 0:
		if i // 2 < 0:
			print(0)
		else:
			print(i // 2 - 1)
	elif i // 2 < 0:
		print(0)
	else:
		print(i // 2)


k = int(input())
for _ in range(k):
	n = int(input())
	calc = (n - 1) // 2
	print(calc)


from math import floor
n = int(input())
a = int()
for i in range(n):
	m = int(input())
	if m == 1:
		print(0)
	else:
		a = floor(m / 2)
		if m % 2 == 0:
			print(a - 1)
		else:
			print(a)


t = int(input())
for _ in range(0, t):
	n = int(input())
	print((n - 1) // 2)


tests = int(input())
for i in range(tests):
	n = int(input())
	if n % 2 == 0:
		count = n / 2 - 1
	else:
		count = (n - 1) / 2
	print(int(count))


import sys
input = sys.stdin.readline
import heapq
import copy
import math

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

class Node:

	def _init_(self, val):
		self.data = val
		self.left = None
		self.right = None

class fen_tree:

	def __init__(self, list):
		self.array = [0] + list
		for idx in range(1, len(self.array)):
			idx2 = idx + (idx & -idx)
			if idx2 < len(self.array):
				self.array[idx2] += self.array[idx]

	def prefix_query(self, idx):
		result = 0
		while idx:
			result += self.array[idx]
			idx -= idx & -idx
		return result

	def prints(self):
		print(self.array)
		return

	def range_query(self, from_idx, to_idx):
		return self.prefix_query(to_idx) - self.prefix_query(from_idx - 1)

	def update(self, idx, add):
		while idx < len(self.array):
			self.array[idx] += add
			idx += idx & -idx

def pre_sum(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def pre_back(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def search_leftmost(arr, val):

	def helper(arr, l, r, val):
		print(l, r)
		if arr[l] == val:
			return l
		if r - l <= 1:
			if arr[r] == val:
				return r
			else:
				print('not found')
				return
		mid = int((r + l) / 2)
		if arr[mid] >= val:
			return helper(arr, l, mid, val)
		else:
			return helper(arr, mid, r, val)
	return helper(arr, 0, len(arr) - 1, val)

def search_rightmost(arr, val):

	def helper(arr, l, r, val):
		print(l, r)
		if arr[r] == val:
			return r
		if r - l <= 1:
			if arr[l] == val:
				return r
			else:
				print('not found')
				return
		mid = int((r + l) / 2)
		if arr[mid] > val:
			return helper(arr, l, mid, val)
		else:
			return helper(arr, mid, r, val)
	return helper(arr, 0, len(arr) - 1, val)

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	for test in range(tests):
		n = inp()
		if n == 0 or n == 1 or n == 2:
			print(0)
		else:
			print(n - 1 - (n + 1) // 2 + n % 2)
main()


num_casos = int(input())

def doces(num):
	cont = 0
	if num >= 3:
		num -= 1
		cont = num // 2
	return cont
lista = []
for i in range(num_casos):
	num_doces = int(input())
	lista.append(doces(num_doces))
for i in range(len(lista)):
	print(lista[i])


def Calculate(n):
	even = False
	if n % 2 == 0:
		even = True
	if even:
		result = int(n / 2) - 1
		print(result)
	else:
		result = int(n // 2)
		print(result)
test_cases = int(input())
for x in range(test_cases):
	Calculate(int(input()))


import math as m
for _ in range(int(input())):
	n = int(input())
	if n <= 2:
		print(0)
	else:
		print(m.ceil(n / 2) - 1)


def solve(n):
	out = 0
	if n > 2:
		out = n // 2
		if n % 2 == 0:
			out -= 1
	return out
T = int(input())
for x in range(T):
	n = int(input())
	y = solve(n)
	print(y)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	cases = 0
	if n != 1:
		if n % 2 == 0:
			a = int(n / 2 + 1)
			b = n - a
			print(b)
		else:
			a = int(math.ceil(n / 2))
			b = n - a
			print(b)
	else:
		print(0)


import sys

def data():
	return sys.stdin.buffer.readline().strip()
out = sys.stdout.write

def mdata():
	return map(int, data().split())
for i in range(int(data())):
	n = int(data())
	if n <= 2:
		out(str(0) + '\n')
	else:
		ans = n // 2
		if n % 2 == 0:
			ans -= 1
		out(str(ans) + '\n')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
for _ in range(ii()):
	n = ii()
	if n % 2 == 0:
		sol = n // 2 - 1
	else:
		sol = n // 2
	print(sol)


t = int(input())
for _ in range(t):
	n = int(input())
	a = 1 + n // 2
	print(n - a)


t = int(input())
count = 0
for i in range(t):
	n = int(input())
	count = (n - 1) // 2
	print(count)


def getNum():
	try:
		return int(input())
	except:
		return getNum

def case(n):
	return (n - 1) // 2

def main():
	num = getNum()
	n = 0
	while n < num:
		print(case(getNum()))
		n += 1
main()


def answer(n):
	if n == 2:
		return 0
	if n % 2 == 0:
		return int(n / 2 - 1)
	else:
		return int((n - 1) / 2)
testCount = int(input())
for _ in range(testCount):
	n = int(input())
	print(answer(n))


Y = int(input())
for y in range(Y):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


testcases = int(input())
for _ in range(testcases):
	c = int(input())
	if c <= 2:
		print('0')
	elif c % 2 == 0:
		print(c // 2 - 1)
	else:
		print(c // 2)


import math
n = int(input())
while n > 0:
	x = int(input())
	if x <= 2:
		print('0')
	else:
		res = math.ceil(x / 2)
		print(res - 1)
	n = n - 1


T = int(input())
for _ in range(T):
	d = int(input())
	if d < 2:
		print('0')
	elif d % 2 == 0:
		print(d // 2 - 1)
	else:
		print(d // 2)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	n = ii()
	print(n - 1 - n // 2)


import math
g = lambda x: map(x, input().split())

def main():
	t = int(input())
	while t:
		n = int(input())
		x = n // 2 + 1
		print(n - x)
		t -= 1
main()


import sys
t = sys.stdin.readline()
while t:
	t = int(t)
	n = int(input())
	ans = 0
	if n == 1 or n == 2:
		ans = 0
	elif n % 2 == 0:
		ans = n // 2 - 1
	else:
		ans = n // 2
	print(ans)
	t -= 1


n = int(input())
for i in range(1, n + 1):
	candies = int(input())
	if candies % 2 == 0:
		d_candies = candies // 2 - 1
	else:
		d_candies = candies // 2
	print(d_candies)


n = int(input())
s = [int(input()) for _ in range(n)]
for i in s:
	x = (i - 1) // 2
	print(x)


cases = int(input())
tests = []
for i in range(cases):
	n = int(input())
	tests.append(n)
for num in tests:
	b = num / 2
	if num % 2 == 0 and b > 1:
		print(int(b - 1))
	elif b > 1:
		print(int(b))
	else:
		print(0)


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
tests = inp()
testcount = 0
while testcount < tests:
	candies = inp()
	print(math.floor((candies - 1) / 2))
	testcount += 1


def foo(a):
	if a % 2:
		print(a // 2)
	else:
		print(a // 2 - 1)
test = int(input())
for each in range(test):
	foo(int(input()))


n = int(input())

def check(x):
	if x == 0 or x == 1 or x == 2:
		print('0')
	elif x % 2 == 0:
		print(int(x / 2) - 1)
	else:
		print(int(x / 2))
for i in range(n):
	p = int(input())
	check(p)


n = int(input())
while n > 0:
	m = int(input())
	w = 0
	if m > 0:
		if m % 2 == 0:
			w = m // 2 - 1
		else:
			w = m // 2
	print(w)
	n -= 1


from sys import stdout, stdin, setrecursionlimit
from math import log2, floor
mod = 1000000007
cin = stdin.readline
cout = stdout.write

def main():
	n = int(cin())
	ans = n // 2
	if n % 2 == 0:
		ans -= 1
	ans = max(0, ans)
	cout(f'{ans}\n')
t = 1
t = int(input())
while t > 0:
	main()
	t = t - 1


from math import ceil, sqrt, log, gcd

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

def si():
	return input()

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

def li():
	return list(mi())
for _ in range(ii()):
	n = ii()
	if n <= 2:
		print('0')
	elif n & 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


t = int(input())
np = [0] * t
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		np[i] = int(n / 2 - 1)
	elif n % 2 == 1:
		np[i] = int(n // 2)
for i in range(t):
	print(np[i])


s = input()
for i in range(int(s)):
	k = int(input())
	if k < 3:
		print(0)
	elif k % 2 == 0:
		k = int(k / 2)
		print(k - 1)
	else:
		print(int(k / 2))


from math import ceil
T = int(input())
while T > 0:
	A = int(input())
	B = ceil(A - A / 2 - 1)
	print(B)
	T -= 1


iter = int(input())
for i in range(iter):
	candy_num = int(input())
	if candy_num % 2 == 0:
		print(candy_num // 2 - 1)
	else:
		print(candy_num // 2)


t = int(input())
ans = []
for a in range(t):
	n = int(input())
	if n <= 2:
		ans.append(0)
	elif n % 2 == 0:
		ans.append(n // 2 - 1)
	elif n % 2 != 0:
		ans.append(n // 2)
for i in ans:
	print(i)


x = int(input(''))
count = 1
while count <= x:
	count = count + 1
	candy_number = int(input(''))
	if candy_number < 3:
		print('0')
	elif candy_number % 2 == 0:
		output = int(candy_number / 2 - 1)
		print(output)
	else:
		output = int((candy_number - 1) / 2)
		print(output)


q = int(input())
for i in range(q):
	w = int(input())
	n = w // 2 - abs(w % 2 - 1)
	print(n)


n = int(input())
l = []
r = []
for i in range(n):
	a = int(input())
	l.append(a)
	if a == 1:
		r.append(l[i] // 2)
	elif a % 2 == 0:
		r.append(l[i] // 2 - 1)
	else:
		r.append(l[i] // 2)
for i in r:
	print(i)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n & 1:
			ans = n // 2
		else:
			ans = (n - 1) // 2
		print(ans)
main()


def solution():
	from sys import stdout, stdin
	(_input, _print) = (stdin.readline, stdout.write)
	(_int, _range) = (int, range)
	for _ in range(int(input())):
		x = int(input())
		if x < 3:
			print(0)
		else:
			print((x - 1) // 2)
solution()


import math
n = int(input())
b = list()
for i in range(n):
	q = int(input())
	q = (q - 1) / 2
	q = math.floor(q)
	b.append(q)
for i in range(len(b)):
	print(b[i])


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	print((n - 1) // 2)


test = int(input())

def solve():
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
for x in range(test):
	solve()


t = int(input())
arr = []
for i in range(t):
	n = int(input())
	if n % 2 == 1:
		b = n // 2
	else:
		b = n / 2 - 1
	arr.append(int(b))
print(*arr, sep='\n')


val = int(input())
qtdDoces = 0
qtdFormas = 0
for i in range(val):
	qtdDoces = int(input())
	if qtdDoces <= 2:
		qtdFormas = 0
	elif qtdDoces % 2 == 0:
		qtdFormas = qtdDoces / 2 - 1
	else:
		qtdFormas = (qtdDoces - 1) / 2
	print(int(qtdFormas))


inp = int(input())

def fnc(n):
	if n >= 3:
		half = (n - 2) / 2
		flr = (n - 2) // 2
		if half == flr:
			return flr
		else:
			return flr + 1
	else:
		return 0
for i in range(inp):
	print(fnc(int(input())))


from math import ceil, gcd, floor, log
from collections import deque, defaultdict as dict
from heapq import heappush as hpush, heappop as hpop, heapify
from functools import lru_cache
import sys

def inpi():
	return int(input())

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

def inp():
	s = input()
	return list(s)

def inpv():
	return map(int, input().split())
testcase = int(input())
for test in range(testcase):
	n = inpi()
	if n < 2:
		print(0)
	else:
		print((n - 1) // 2)


n = int(input())
ans = []
for i in range(n):
	a = int(input())
	if a < 3:
		ans.append(0)
	elif a % 2 == 0:
		ans.append(a - (a + 2) // 2)
	else:
		ans.append(a - (a // 2 + 1))
for y in ans:
	print(y)


t = int(input())
for test_case in range(t):
	n = int(input())
	ways = (n - 1) // 2
	print(ways)


a = int(input())
l = []
for i in range(0, a):
	b = int(input())
	if b % 2 != 0:
		count = b // 2
	else:
		count = (b - 1) // 2
	l.append(count)
for j in l:
	print(j)


t = int(input())
while t > 0:
	sum = 0
	a = int(input())
	sum = a - 1
	print(sum // 2)
	t -= 1


def fun(n):
	if n < 3:
		return 0
	elif n % 2 == 1:
		return int(n / 2)
	else:
		return int(n / 2) - 1
t = int(input())
for _ in range(t):
	n = int(input())
	print(fun(n))


import math
n = int(input())
Result = []
for i in range(0, n):
	x = int(input())
	Result.append(math.floor((x - 1) / 2))
for i in Result:
	print(i)


s = int(input())
l = []
for i in range(s):
	r = int(input())
	if r // 2 == 0:
		l.append(0)
	elif r % 2 == 0:
		o = r // 2 - 1
		l.append(o)
	else:
		l.append(r // 2)
for m in l:
	print(m)


def permutation_nb(n):
	n = int(n)
	if n % 2 == 1:
		b = n // 2
	else:
		b = n // 2 - 1
	print(b)

def read():
	n = input()
	return n
tests = int(input())
ns = [read() for _ in range(tests)]
for n in ns:
	permutation_nb(n)


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
t = ii()
for _ in range(t):
	n = ii()
	print(n - math.floor(n / 2) - 1)


inp = int(input())
while inp:
	candies = int(input())
	if candies % 2 == 0:
		print(int(candies / 2) - 1)
	else:
		print(int(candies / 2))
	inp -= 1


t = int(input())
z = []
for i in range(0, t):
	n = int(input())
	z.append(n)
i = 0
while i < len(z):
	if z[i] % 2 != 0:
		print(int((z[i] - 1) / 2))
		i += 1
	else:
		print(int((z[i] - 2) / 2))
		i += 1


import math
t = int(input())
while t:
	t = t - 1
	n = int(input())
	ans = math.ceil(n / 2) - 1
	print(ans)


import math
t = int(input())
for i in range(t):
	count = 0
	n = int(input())
	print(math.ceil(n / 2 - 1))


from __future__ import division, print_function
import os
import sys
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
from math import gcd
from bisect import bisect
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
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')
read = lambda : list(map(int, input().strip().split(' ')))

def solution():
	o = int(input())
	for i in range(o):
		n = int(input())
		if n < 3:
			print(0)
		elif n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
solution()


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

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

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

def I():
	return int(stdin.readline())
P = 1000000007
for t in range(I()):
	n = I()
	if n <= 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print((n - 1) // 2)


n = int(input())
res = []
for i in range(n):
	k = int(input())
	a = k // 2 + 1
	b = k - a
	res.append(b)
for i in res:
	print(i)


from sys import stdin
cases = int(stdin.readline().strip())
for i in range(cases):
	n = int(stdin.readline().strip())
	posibles_casos = (n - 1) // 2
	print(posibles_casos)


num_cases = int(input())
case_list = []
for i in range(num_cases):
	case = int(input())
	case_list.append(case)
for case in case_list:
	if case % 2 == 0:
		print(case // 2 - 1)
	else:
		print(case // 2)


t = int(input())
for tc in range(t):
	n = int(input())
	if n < 2:
		print(0)
	elif n % 2 != 0:
		j = n // 2
		print(j)
	else:
		j = n // 2
		print(j - 1)


t = int(input())
for i in range(0, t):
	candies = int(input())
	if candies % 2 == 0:
		ways = (candies - 1) // 2
	else:
		ways = candies // 2
	print(ways)


for i in range(int(input())):
	c = int(input())
	f = c // 2
	if c % 2 == 0:
		f -= 1
	print(f)


import math
from collections import Counter

def solve():
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	else:
		v = n - 1
		m = n // 2
		print(v - m)
for _ in range(int(input())):
	solve()


times = int(input())
for i in range(times):
	num = int(input())
	if num < 3:
		print('0')
	elif num % 2 == 0:
		print(num // 2 - 1)
	else:
		print(num // 2)


n = int(input())
for i in range(n):
	x = int(input())
	print(x - x // 2 - 1)


import sys
t = int(input())
for q in range(t):
	n = int(input())
	if n <= 2:
		print(0)
		continue
	print(n - n // 2 - 1)


import math
t = int(input())
while t != 0:
	n = int(input())
	if n == 1 or n == 2:
		print('0')
	else:
		print(math.trunc((n - 1) / 2))
	t = t - 1


x = int(input())
for i in range(0, x):
	c = int(input())
	if c <= 2:
		print(0)
	elif c > 2 and c % 2 == 1:
		print(c // 2)
	else:
		print(c // 2 - 1)


import sys
first = 1
for line in sys.stdin:
	values = list(map(int, line.split()))
	if first == 1:
		first = 0
		continue
	a = values[0]
	if a % 2 == 0:
		print(a // 2 - 1)
	else:
		print(a // 2)


t = int(input())
arr = []
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		arr.append(n // 2 - 1)
	else:
		arr.append(n // 2)
for i in arr:
	print(i)


def main():
	for _ in range(int(input())):
		n = int(input())
		k = n // 2 + 1
		if n - k > 0:
			print(n - k)
		else:
			print('0')
main()


t = int(input())
p = []
for i in range(t):
	g = int(input())
	p.append(g)
for i in range(t):
	if p[i] == 1 or p[i] == 2:
		print(0)
	elif p[i] % 2 == 0:
		print(int(p[i] / 2 - 1))
	else:
		print(p[i] // 2)


test_cases = int(input())
for i in range(test_cases):
	total_candies = int(input())
	if total_candies % 2 == 0:
		print(total_candies // 2 - 1)
	else:
		print(total_candies // 2)


from sys import stdin
input = stdin.readline

def A():
	for i in range(int(input())):
		print((int(input()) - 1) // 2)

def B():
	return

def C():
	return

def D():
	return
A()


from math import ceil
for i in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


import math
tc = input()
r = []
for i in range(0, int(tc)):
	n = input()
	n = int(n)
	if n % 2 == 0:
		r.append(int(n / 2) - 1)
	else:
		r.append(int(math.floor(n / 2)))
for x in r:
	print(x)


import math
for _ in range(int(input())):
	a = int(input())
	ans = 0
	ans = math.ceil(a / 2 - 1)
	print(ans)


def solve():
	N = int(input())
	print(N - (int(N // 2) + 1))
T = int(input())
for t in range(T):
	solve()


import math
T = input()
t = int(T)
for cases in range(t):
	P = input()
	p = int(P)
	if p % 2 == 0:
		print(int(p / 2 - 1))
	else:
		print(p - math.ceil(p / 2))


def solveAll():
	nbCases = int(input())
	for _ in range(nbCases):
		case = readCase()
		print(solve(case))

def readCase():
	return int(input())

def solve(case):
	return (case - 1) // 2
solveAll()


n = input()
n = int(n)
collection = list()
for i in range(n):
	c = input()
	c = int(c)
	collection.append(c)
for c in collection:
	if c > 2:
		if c % 2 == 0:
			res = int(c / 2 - 1)
			print(res)
		else:
			res = int((c - 1) / 2)
			print(res)
	else:
		print(0)


def fun(k):
	if k <= 2:
		return 0
	if k % 2 == 0:
		return k // 2 - 1
	return k // 2
n = int(input())
for i in range(n):
	k = int(input())
	print(fun(k))


import sys
import collections
import threading

def main():
	testn = int(input())
	for _ in range(testn):
		n = int(input())
		if n % 2 == 0:
			print(n // 2 - 1)
		else:
			print((n - 1) // 2)
input = sys.stdin.readline
main()


boosted = int(input(''))
ans = []
for i in range(boosted):
	n = int(input(''))
	if n == 2 or n == 1:
		ans.append(0)
	elif n % 2 == 0:
		ans.append(n // 2 - 1)
	else:
		ans.append(n // 2)
for j in ans:
	print(j)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3:
		print(0)
	else:
		print(n - 1 - math.floor(n / 2))


def twoSis(n):
	if n == 1 or n == 2:
		return 0
	elif n % 2 == 0:
		return n // 2 - 1
	elif n % 2 != 0:
		return n // 2
tc = int(input())
for i in range(tc):
	n = int(input())
	print(twoSis(n))


t = int(input())
for test in range(t):
	n = int(input())
	if n < 3:
		print('0')
		continue
	num = n - n // 2
	num -= 1
	print(num)


import sys
for t in range(int(input())):
	n = int(input())
	print((n - 1) // 2)


def solve(n):
	return (n - 1) // 2
for _ in range(int(input())):
	print(solve(int(input())))


for p in [*open(0)][1:]:
	print(int(p) - 1 >> 1)


testCases = int(input())
candies = []
for i in range(testCases):
	candies.append(int(input()))
result = []
for candy in candies:
	if candy == 1 or candy == 2:
		result.append(0)
	elif candy % 2 == 0:
		result.append(candy // 2 - 1)
	else:
		result.append(candy // 2)
for ans in result:
	print(ans)


for _ in range(int(input())):
	a = int(input())
	if a % 2 == 0 and a > 2:
		print('%d' % (a / 2 - 1))
	elif a > 2:
		print('%d' % (a / 2))
	else:
		print('0')


def solve():
	x = int(input())
	print((x - 1) // 2)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for q in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
		continue
	count = n - n // 2 - 1
	print(count)


import math
n = int(input(''))
for i in range(n):
	x = int(input(''))
	if x == 0 or x == 1 or x == 2:
		print(0)
	elif x % 2 == 0:
		print(int(x / 2 - 1))
	else:
		print(math.floor(x / 2))


def Lia(n):
	if n < 3:
		print(0)
	else:
		if n % 2 == 0:
			n //= 2
			n -= 1
		else:
			n //= 2
		print(n)
for i in range(int(input())):
	n = int(input())
	Lia(n)


itr = int(input())
for _ in range(itr):
	candy = int(input())
	re = candy // 2
	if candy % 2 == 0:
		re -= 1
	print(re)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 1 and n > 2:
		print(n // 2)
	if n == 1 or n == 2:
		print('0')
	if n % 2 == 0 and n > 2:
		print(n // 2 - 1)


l = []
for _ in range(int(input())):
	a = int(input())
	if a % 2 == 0:
		c = a / 2
		res = a - c - 1
		l.append(int(res))
	else:
		c = a - 1
		d = c / 2
		res = d
		l.append(int(res))
for x in l:
	print(x)


t = int(input())
ans = []
for s in range(t):
	n = int(input())
	ans.append(n - int(n / 2) - 1)
for it in ans:
	print(it)


test_cases = int(input())
candies_data = []
while test_cases > 0:
	candies_data.append(int(input()))
	test_cases -= 1
for test in candies_data:
	print((test - 1) // 2)


c = int(input())
for i in range(c):
	n = int(input())
	print(n - n // 2 - 1)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		answer = n - (n // 2 + 1)
		print(answer)
main()


t = int(input())
for c in range(t):
	cn = int(input())
	if cn % 2 == 0:
		print(int((cn - 2) / 2))
	else:
		print(int((cn - 1) / 2))


t = int(input())
for i in range(t):
	n = int(input())
	a = n // 2
	cnt = max(0, n - a - 1)
	print(cnt)


def reparto(dulces):
	rango = range(dulces // 2 + 1, dulces)
	return len(rango)
tests = int(input())
for i in range(tests):
	dulces = int(input())
	print(reparto(dulces))


import math
t = int(input())

def solve(n):
	cnt = 0
	return math.ceil(n / 2) - 1
for _ in range(t):
	n = int(input())
	print(solve(n))


import math
inp = input()
for i in range(int(inp)):
	num = int(input())
	print(math.ceil(num / 2 - 1))


x = int(input())
for i in range(x):
	z = int(input())
	qol = 0
	a = int(z / 2) + 1
	b = int(z / 2)
	print(z - int(z / 2 + 1))


_ = input
p = int
for f in [-(-p(_()) // 2) - 1 for i in '_' * p(_())]:
	print(f)


n = int(input())
numbers = []
result = []
for i in range(n):
	numbers.append(int(input()))
for number in numbers:
	if number % int(2) == int(0):
		result.append(int(number / int(2) - int(1)))
	else:
		result.append(int(number / int(2)))
print(*result, sep='\n')


for a in [*open(0)][1:]:
	print(int(a) - 1 >> 1)


t = int(input())
for i in range(t):
	N = int(input())
	if N == 1:
		print(0)
	elif N == 2:
		print(0)
	elif N % 2 == 0:
		print(int(N / 2 - 1))
	elif N % 2 != 0:
		print(int((N - 1) / 2))


t = int(input())

def sisterhood():
	for i in range(t):
		n = int(input())
		if n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
	return
sisterhood()


v = int(input())
c = []
for i in range(v):
	c.append(int(input()))
for i in range(v):
	print((c[i] - 1) // 2)


from sys import stdin
import math
inp = stdin.readline
t = int(inp().strip())
while t:
	t -= 1
	n = int(inp().strip())
	print(n // 2 - (0 if n % 2 == 1 else 1))


t = int(input())
while t > 0:
	tot = int(input())
	if tot < 3:
		print('0')
	elif tot % 2 == 0:
		print(tot // 2 - 1)
	else:
		print(tot // 2)
	t -= 1


import math
testCases = int(input())
for _ in range(testCases):
	n = int(input())
	half = n / 2
	if half % 1 == 0:
		print(int(half - 1))
	else:
		print(int(math.floor(half)))


t = int(input())
while t:
	import math
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	else:
		value = math.floor(n / 2) + 1
		print(n - value)
	t -= 1


t = int(input())
li = []
for i in range(t):
	n = int(input())
	a = n - 1 - n // 2
	li.append(a)
for i in li:
	print(i)


import math
t = int(input())
while t != 0:
	i = int(input())
	if i % 2 == 0:
		print(math.floor(i / 2) - 1)
	else:
		print(math.floor(i // 2))
	t = t - 1


import math
t = int(input())
while t:
	n = int(input())
	if n % 2 == 0:
		m = n / 2
		print(int(m - 1))
	elif n % 2 == 1:
		print(math.floor(n / 2))
	t = t - 1


t = int(input())
res = []
for i in range(t):
	n = int(input())
	if n != 1 and n != 2:
		if n % 2 == 0:
			x = n // 2
			y = n - x
			res.append(x - 1)
		else:
			x = n // 2
			y = n - x
			res.append(x)
	else:
		res.append(0)
print(*res, sep='\n')


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
anzahl_tests = inp()
for i in range(anzahl_tests):
	falle = 0
	alle = inp()
	if alle % 2 == 0:
		falle = alle / 2 - 1
	else:
		falle = math.ceil(alle / 2) - 1
	print(int(falle))


a = 0
for i in range(int(input())):
	a = int(input())
	print(a // 2 - (a - 1) % 2)


T = int(input())
ans = []
for i in range(T):
	n = int(input())
	if n % 2 == 0:
		ans.append(n // 2 - 1)
	else:
		ans.append(n // 2)
for i in range(len(ans)):
	print(ans[i])


s = int(input())
for a in range(s):
	h = int(input())
	t = (h - 1) // 2
	print(t)


def ans(n):
	if n % 2 == 1:
		return int(n // 2)
	return int(n / 2) - 1
L = []
t = int(input())
for i in range(t):
	n = int(input())
	L.append(ans(n))
for l in L:
	print(l)


for q in range(int(input())):
	n = int(input())
	print((n - 1) // 2)


t = int(input())
for i in range(t):
	a = int(input())
	z = (a - 1) // 2
	print(z)


t = int(input())
for _ in range(t):
	n = int(input())
	half = n // 2
	if n % 2:
		print(half)
	else:
		print(half - 1)


tests = int(input())
for i in range(tests):
	a = int(input())
	print(a // 2 - int(a % 2 == 0))


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	n = int(input())
	print((n - 1) // 2 if (n - 1) // 2 > 0 else 0)


def candiesAndSisters():
	n = int(input())
	l = []
	for i in range(n):
		value = int(input())
		l.append(int((value - 1) / 2))
	for i in l:
		print(i)
candiesAndSisters()


test_cases = int(input())
candies = []
for _ in range(test_cases):
	candies.append(int(input()))
for num in candies:
	if num % 2 == 0:
		print(num // 2 - 1)
	else:
		print(num // 2)


inp = lambda cast=int: [cast(x) for x in input().split()]
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
(t,) = inp()
for _ in range(t):
	(n,) = inp()
	if n % 2:
		print(n // 2)
	else:
		print(n // 2 - 1)


import math
for i in range(int(input())):
	print(math.floor((int(input()) - 1) / 2))


import sys, math, cmath, time
start_time = time.time()

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

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

def solve():
	n = inp()
	if n <= 2:
		print(0)
	elif n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)
ONLINE_JUDGE = __debug__
if not ONLINE_JUDGE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
t = 1
t = inp()
for tt in range(t):
	solve()
if not ONLINE_JUDGE:
	print('Time Elapsed:', time.time() - start_time, 'seconds')
sys.stdout.close()


t = int(input())

def noways(n):
	if n < 2:
		return 0
	elif n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2
for i in range(t):
	n = int(input())
	print(noways(n))


import math
t = int(input())
while t:
	t -= 1
	num = int(input())
	if num == 1 or num == 2:
		print('0')
	elif num % 2 == 0:
		print(math.floor(num // 2) - 1)
	else:
		print(math.floor(num // 2))


T = int(input())
for i in range(T):
	n = int(input())
	l = n // 2 + 1
	rem = 0
	if l > 1 and l < n:
		rem = n - l
		print(rem)
	else:
		print(0)


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for i in range(t):
	n = int(input())
	if n <= 2:
		print(0)
	else:
		print((n + 1) // 2 - 1)


n = int(input())
n1 = 0
sum1 = 0
for i in range(n):
	n1 = int(input())
	if n1 % 2 == 0:
		n1 -= 1
	sum1 = n1 // 2
	print(sum1)


t = int(input())
while t > 0:
	temp = int(input())
	print(temp - 1 - temp // 2)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	ans = n // 2 - (n % 2 == 0)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ways = n // 2 - 1 if n % 2 == 0 else n // 2
	print(max(0, ways))


def candles(n):
	return n - int(n / 2) - 1
t = int(input())
lst = []
for i in range(0, t):
	n = int(input())
	lst.append(candles(n))
for i in lst:
	print(i)


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


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	if n <= 2:
		outln(0)
	else:
		outln(ceil(n / 2) - 1)


for s in list(map(int, [*open(0)][1:])):
	print(-1 * (-s // 2) - 1)


import math
for i in [0] * int(input()):
	print(math.ceil(int(input()) / 2) - 1)


n = int(input())
for _ in range(n):
	x = int(input())
	res = x - (x // 2 + 1)
	print(res)


q = int(input())
for q in range(q):
	n = int(input())
	print(n - 1 - n // 2)
exit()
(n, k) = map(int, input().split())
ans = 0
for i in range(k, n + 2):
	mn = i * (i - 1) // 2
	mx = (2 * (n - i + 1) + (i - 1)) * i // 2
	ans += mx - mn + 1
	ans = ans % (10 ** 9 + 7)
print(ans)


for i in range(int(input())):
	print((int(input()) - 1) // 2)


t = int(input())
i = 0
while i < t:
	n = int(input())
	print(n - 1 - n // 2)
	i += 1


from math import ceil
for _ in range(int(input())):
	N = int(input())
	print(ceil(N / 2) - 1)


import math
x = int(input())
l = list()
for i in range(x):
	l.append(int(input()))
for j in l:
	f = math.ceil(j / 2)
	print(f - 1)


from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for _ in range(t):
	n = ii()
	m = floor(n / 2) + 1
	if m <= 1:
		print(0)
	else:
		print(n - m)


def find_combo():
	numeri = []
	inp = input()
	for x in range(int(inp)):
		numeri.append(input())
	for i in numeri:
		print((int(i) - 1) // 2)
find_combo()


def candy(n):
	s = 0
	a = 0
	if n > 2:
		n = n - 2
		a = n // 2 + +1
		s = n - a + 1
	return s
n = int(input())
l = []
for i in range(n):
	m = int(input())
	l.append(candy(m))
for i in l:
	print(i)


t = int(input())
for i in range(t):
	s = int(input())
	if s / 2 == s // 2:
		print(s // 2 - 1)
	else:
		print(s // 2)


for _ in range(int(input())):
	print(str((int(input()) - 1) // 2))


cases = int(input())
mylist = []
resultlist = []
for i in range(cases):
	mylist.append(eval(input()))
for num in mylist:
	if num <= 2:
		resultlist.append(0)
	elif num % 2 == 0:
		resultlist.append(num // 2 - 1)
	else:
		resultlist.append((num - 1) // 2)
for num in resultlist:
	print(num)


t = int(input())
a = []
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		k = n // 2 - 1
	else:
		k = n // 2
	a.append(k)
	k = 0
for i in a:
	print(i)


q = int(input())
ans = []
for i in range(0, q):
	n = int(input())
	ans.append((n - 1) // 2)
for k in range(0, q):
	print(ans[k])


import sys
import math
from collections import Counter
input = sys.stdin.readline
from functools import lru_cache
import bisect

def solve():
	n = int(input())
	ans = math.ceil(n / 2) - 1
	print(ans)
t = int(input())
for _ in range(t):
	solve()


def main():
	for _ in range(int(input())):
		N = int(input())
		if N % 2 == 0:
			x = N // 2 + 1
		else:
			x = (N + 1) // 2
		print(N - x)
main()


t = int(input())
while t > 0:
	n = int(input())
	ans = (n - 1) // 2
	print(ans)
	t -= 1


a = int(input())
for i in range(a):
	candies = int(input())
	if candies == 1 or candies == 2:
		print(0)
	else:
		print(int(candies - (candies // 2 + 1)))


from sys import stdin, stdout
import operator

def main():
	t = int(stdin.readline())
	for i in range(t):
		n = int(stdin.readline())
		res1 = n // 2
		res2 = n - res1
		if res2 == 0:
			print(0)
		else:
			print(res2 - 1)
main()


from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect

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

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

def LS():
	return [list(x) for x in sys.stdin.readline().split()]

def S():
	res = list(sys.stdin.readline())
	if res[-1] == '\n':
		return res[:-1]
	return res

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

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

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

def LSR(n):
	return [LS() for i in range(n)]
sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
	t = I()
	for _ in range(t):
		n = I()
		print(n - 1 >> 1)
	return

def __starting_point():
	solve()
__starting_point()


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

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

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

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

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		x = I()
		y = (x - 1) // 2
		ans.append(y)
	for x in ans:
		print(x)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	sol = (n - 1) // 2
	print(sol)


from sys import stdin, stdout
import traceback
import math
import bisect
from typing import List, Tuple
import itertools as it
read = lambda : stdin.readline().strip()
write = stdout.write
writeln = lambda x: write(str(x) + '\n')

def reads(typ=int):
	return list(map(typ, read().split()))

def enumerate_sorted(iterable):
	return sorted(zip(it.count(), iterable), key=lambda x: x[1])

class Sol:

	def solve(self):
		n = int(read())
		return (n - 1) // 2
try:
	T = int(read())
	for _ in range(T):
		res = Sol().solve()
		writeln(res)
except Exception as e:
	print('Got exception:', repr(e))
	print(traceback.format_exc())


t = int(input())
m = ''
for x in range(t):
	i = int(input())
	c = 0
	if i % 2 == 0:
		c = i // 2 - 1
	else:
		c = i // 2
	m += str(c) + '\n'
print(m)


n = int(input())
test = []
for i in range(n):
	test.append(int(input()))
for a in test:
	div = a // 2
	print(a - 1 - div)


import math
n = int(input())
i = 0
while i < n:
	x = float(input())
	a = x / 2
	print(math.ceil(a) - 1)
	i = i + 1


def candies(n):
	return n - n // 2 - 1
t = int(input())
for i in range(t):
	n = int(input())
	print(candies(n))


test = int(input())
for t in range(test):
	c = int(input())
	if c == 0 or c == 1 or c == 2:
		print(0)
	elif c % 2 == 0:
		print(c // 2 - 1)
	else:
		print(c // 2)


w = int(input())
for i in range(0, w):
	p = int(input())
	c = int((p - 1) / 2)
	print(c)


from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = 998244353

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())
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}

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
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

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 = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			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):
		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
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def find_all_paths(graph, start, end, path=[]):
	path = path + [start]
	if start == end:
		return path
	paths = []
	for node in graph[start]:
		if node not in path:
			newpaths = find_all_paths(graph, node, end, path)
			for newpath in newpaths:
				paths.append(newpath)
	return paths
for _ in range(ii()):
	n = ii()
	print((n - 1) // 2)


import sys
input = sys.stdin.buffer.readline
tests = int(input())
for ii in range(tests):
	n = int(input())
	ans = 0
	ans = n - n // 2 - 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0, end='')
	else:
		print(n - n // 2 - 1, end='')
	if i < t - 1:
		print()


import sys
input = sys.stdin.buffer.readline

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

def mult_input():
	return map(int, input().split())
for nt in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


t = int(input())
while t > 0:
	n = int(input())
	half = n // 2
	half += 1
	print(n - half)
	t -= 1


value = int(input())
for i in range(value):
	values = int(input())
	if values % 2 == 0:
		print(values // 2 - 1)
	else:
		print(values // 2)


import math
tc = int(input())
for test in range(tc):
	num = int(input())
	s = math.ceil(num / 2)
	print(s - 1)


n = int(input())
b = 1
lst = []
for i in range(n):
	cd = int(input())
	lst.append(cd)
for c in lst:
	if c % 2 == 0:
		ans = c // 2 - 1
		print(ans)
	else:
		ans = c // 2
		print(ans)


import sys, bisect
from math import gcd
input = sys.stdin.readline

def inp():
	return int(input().rstrip())

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

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
t = inp()
for _ in range(t):
	n = inp()
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


import math
n = int(input())
for i in range(n):
	a = int(input())
	if a == 1 or a == 2:
		print(0)
	else:
		print(math.ceil(a / 2) - 1)


a = input()
c = []
for i in range(int(a)):
	b = input()
	c.append(b)
c = list(map(int, c))
for i in range(len(c)):
	if c[i] < 3:
		print('0')
	else:
		print(c[i] - c[i] // 2 - 1)


import math as m
t = int(input())
l = []
for i in range(t):
	k = int(input())
	l.append(k)
for n in l:
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(m.floor(n / 2 - 1))
	else:
		print(m.ceil(n / 2 - 1))


for q in range(int(input())):
	c = int(input())
	if c % 2 == 0:
		c -= 1
	print(c // 2)


for t in range(int(input())):
	a = int(input())
	print(max(0, a // 2 - (a % 2 == 0)))


inputNum = int(input())
nums = []
while inputNum > 0:
	inputNum -= 1
	nums.append(int(input()))
for num in nums:
	count = 0
	a = num - 1
	b = 1
	if a + b == num:
		if num % 2 == 0:
			print(int(num / 2) - 1)
		else:
			print(int(num / 2))


import math
T = int(input())
for t in range(T):
	N = int(input())
	print(math.ceil(N / 2) - 1)


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


t = int(input())
if 1 <= t <= 10 ** 4:
	for i in range(t):
		n = int(input())
		if n % 2 == 0:
			m = n / 2 - 1
			m = int(m)
		else:
			m = (n - 1) / 2
			m = int(m)
		print(m)


def main():
	candies = list(map(int, input().split()))[0]
	if candies <= 2:
		print(0)
	elif candies % 2 == 0:
		print(candies // 2 - 1)
	elif candies % 2 != 0:
		print(candies // 2)
test_case = list(map(int, input().split()))[0]
for i in range(test_case):
	main()


def main():
	t = int(input())
	while t > 0:
		t -= 1
		n = int(input())
		if n < 3:
			rez = 0
		elif n % 2 == 0:
			rez = n // 2 - 1
		else:
			rez = n // 2
		print(rez)
main()


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for x in range(t):
		k = int(stdin.readline())
		if k % 2 == 0:
			print(int(k / 2) - 1)
		else:
			print(int(k / 2))
main()


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


for tc in range(int(input())):
	n = int(input())
	print((n - 1) // 2)


t = int(input())
answ = []
for i in range(t):
	n = int(input())
	if n < 3:
		answ.append(0)
	elif n % 2 == 0:
		a = n // 2 - 1
		answ.append(a)
	else:
		a = n // 2
		answ.append(a)
for i in answ:
	print(i)


n = int(input())
for _i in range(0, n):
	k = int(input())
	ans = k // 2
	if k % 2 == 0:
		ans -= 1
	print(ans)


t = int(input())
for testcase in range(t):
	n = int(input())
	if n <= 2:
		print(0)
		continue
	a = n - n // 2
	b = n - a
	time = b
	if a == b:
		time -= 1
	print(time)


from math import ceil
t = int(input())
m = []
for i in range(t):
	m.append(int(input()))
for i in range(t):
	print(ceil(m[i] / 2) - 1)


def solve(n):
	mid = n // 2 + 1
	print(n - mid)
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


def solve(n):
	return 0 if n <= 2 else int((n - 1) / 2)
numTestCase = int(input())
for t in range(numTestCase):
	n = int(input())
	print(solve(n))


T = int(input())
for test in range(T):
	n = int(input())
	half = n // 2 + 1
	print(n - half if half < n else 0)


nt = int(input())
for a in range(nt):
	cand = int(input())
	if not cand >= 2:
		print(0)
	else:
		if not cand % 2:
			cand -= 1
		print(cand // 2)


g = int(input())
a = 0
for i in range(0, g):
	n = int(input())
	if n % 2 == 0:
		a = n / 2 - 1
		a = int(a)
	if n % 2 == 1:
		a = n // 2
	print(a)


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
sys.setrecursionlimit(10 ** 5)

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

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

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

def solve():
	n = II()
	a = n % 2
	if a == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
for _ in range(II()):
	solve()


t = int(input().strip())
while t > 0:
	n = int(input().strip())
	ways = 0
	if n % 2 == 0:
		ways = max(0, n // 2 - 1)
	else:
		ways = max(0, n // 2)
	print(ways)
	t -= 1


from math import floor
t = int(input())
for _ in range(t):
	n = int(input())
	print(floor(0.5 * (n - 1)))


t = int(input())
n = [int(input()) for _ in range(t)]
for ni in n:
	if ni % 2 == 0:
		print((ni - 1) // 2)
	elif ni % 2 == 1:
		print(ni // 2)


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 2:
		print(0)
	elif n == 3 or n == 4:
		print(1)
	elif n & 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


T = int(input())
import math
for t in range(T):
	n = int(input())
	if n % 2 == 0:
		start = n // 2 + 1
		end = n - 1
	else:
		start = int(math.ceil(n / 2))
		end = n - 1
	print(end - start + 1)


from math import *
from copy import *
from heapq import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(x):
	if x == 1:
		return 0
	if x == 2:
		return 0
	else:
		return (x - 1) // 2
T = int(input())
for _ in range(T):
	N = int(stdin.readline())
	print(solve(N))


t = int(input())
for i in range(t):
	k = int(input())
	print(int((k - 1) // 2))


import sys
input = sys.stdin.readline

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

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

def main():
	t = int(input())
	for _ in range(t):
		f()
main()


test_case = int(input())
my_list = []
for i in range(test_case):
	my_list.append(int(input()))
for j in range(test_case):
	if my_list[j] <= 2:
		print(0)
	elif my_list[j] % 2 == 0:
		a = my_list[j] / 2 - 1
		print(int(a))
	else:
		a = my_list[j] / 2 - 0.5
		int(a)
		print(int(a))


x = int(input())
i = 0
while i < x:
	candies = int(input())
	if candies % 2 == 0:
		print(int(candies / 2) - 1)
	else:
		print(int(candies // 2))
	i += 1


import sys

def func():
	n = int(sys.stdin.readline())
	if n == 1:
		return 0
	if n % 2 == 0:
		return n / 2 - 1
	else:
		return n // 2
t = int(sys.stdin.readline())
while t:
	a = func()
	print(int(a))
	t -= 1


n = int(input())
while n:
	m = int(input())
	if m % 2 == 0 and m > 2:
		m = m // 2 - 1
	elif m % 2 != 0 and m > 2:
		m = (m - 1) // 2
	else:
		m = 0
	print(m)
	n -= 1


x = int(input())
s = []
for i in range(x):
	m = int(input())
	if m % 2 != 0:
		s.append(m // 2)
	else:
		s.append(m // 2 - 1)
print(*s, sep='\n')


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


t = int(input())
res = []
for i in range(t):
	n = int(input())
	res.append((n - 1) // 2)
for el in res:
	print(el)


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		k = math.floor(n / 2)
		print(k)


n = int(input())
res = []
for i in range(n):
	x = int(input())
	res.append(int(x / 2 - 1) if not x % 2 else int(x / 2))
for i in res:
	print(i)


tt = int(input())
for i in range(tt):
	n = int(input())
	print((n - 1) // 2)


array = []
n = int(input())
for i in range(0, n):
	Case = int(input())
	array.append(Case - (Case // 2 + 1))
for k in array:
	print(k)


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


from sys import stdin
for i in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n % 2 == 1:
		print((n - 1) // 2)
	else:
		print(n // 2 - 1)


T = int(input())
for x in range(T):
	N = int(input())
	ans = (N - 1) // 2
	print(ans)


import sys
t = int(sys.stdin.readline())
k = 1
while k <= t:
	n = int(sys.stdin.readline())
	if n < 3:
		print(0)
	else:
		num_ways = n - n // 2 - 1
		print(num_ways)
	k = k + 1


t = int(input())
l = []
for i in range(t):
	l.append(int(input()))
for i in range(t):
	if l[i] % 2 == 0:
		print(int(l[i] / 2) - 1)
	else:
		print(int(l[i] / 2))


import sys, threading
sys.setrecursionlimit(10 ** 8)
threading.stack_size(10 ** 8)
from collections import defaultdict, Counter
from queue import Queue
import math

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		half = n / 2
		start = math.ceil(half) if n % 2 else half + 1
		print(max(int(n - start), 0))
threading.Thread(target=main).start()


import math
i = int(input())

def solve():
	n = int(input())
	minGive = math.ceil(n / 2)
	if n % 2 == 0:
		print(n - minGive - 1)
	else:
		print(n - minGive)
for _ in range(i):
	solve()


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	n -= 1
	print(n // 2)
for _ in range(int(input())):
	case()


n = int(input())

def find(a):
	d = a / 2
	c = int(d)
	if a % 2 != 0:
		print(c)
	else:
		print(c - 1)
for i in range(0, n):
	l = int(input())
	find(l)


n = int(input())
for j in range(n):
	num = int(input())
	print(int((num - 1) / 2))


for T in range(int(input())):
	a = int(input())
	b = a // 2 + 1
	print(a - b)


import math
t = int(input())
while t > 0:
	n = int(input())
	n -= 1
	x = n / 2
	print(math.floor(x))
	t -= 1


from math import floor

def distribute_candies(n):
	if n <= 0:
		return 0
	if n % 2 == 0:
		return int(n / 2 - 1)
	else:
		return floor(n / 2)
times = int(input())
for i in range(times):
	n = int(input())
	x = distribute_candies(n)
	print(x)


def floor(n):
	return int(n // 1)
n = int(input())
ans = []
for i in range(n):
	num = int(input())
	if num == 2:
		ans.append(0)
	elif num % 2 == 0:
		ansnum = floor((num - 1) / 2)
		ans.append(ansnum)
	else:
		ansnum = floor(num / 2)
		ans.append(ansnum)
for l in ans:
	print(l)


from math import *
t = int(input())
solutions = []
for i in range(t):
	n = int(input())
	x = floor((n - 1) / 2)
	solutions.append(x)
for i in solutions:
	print(i)


a = int(input())
q = []
for x in range(a):
	b = int(input())
	if b <= 2:
		q.append(0)
	elif b % 2 == 0:
		b = b // 2
		b = b - 1
		q.append(b)
	else:
		b = b - 1
		b = b // 2
		q.append(b)
for x in range(a):
	print(q[x])


def main():
	for _ in range(int(input())):
		print((int(input()) - 1) // 2)
main()


def main():
	test = int(input())
	for t in range(test):
		n = int(input())
		if n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
main()


for _ in range(int(input())):
	n = int(input())
	(x, y) = divmod(n, 2)
	if y == 0:
		print(x - 1)
	else:
		print(x)


from sys import stdin
n = int(input())
for _ in range(n):
	x = int(stdin.readline())
	print(max(0, (x - 1) // 2))


import math
gg = ''
for i in range(int(input())):
	gg += str(math.ceil(int(input()) / 2) - 1) + '\n'
print(gg)


n = int(input())
l = []
for i in range(n):
	s = int(input())
	l.append(s)
for i in l:
	if i % 2 == 0:
		x = int(i / 2) - 1
		print(x)
	else:
		x = int(i / 2)
		print(x)


import sys
t = int(sys.stdin.readline().rstrip())

def main():
	for _ in range(t):
		n = int(sys.stdin.readline().rstrip())
		print((n + 1) // 2 - 1)
main()


for _ in range(int(input())):
	n = int(input())
	print(int((n ** 2 - n + 1) ** 0.5 // 2))


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi

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

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

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		for _ in range(I()):
			a = I()
			if a & 1 == 1:
				print(a // 2)
			else:
				print(a // 2 - 1)
	except:
		pass
M = 998244353
P = 1000000007
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print('0')
	elif n % 2 == 0 and n > 3:
		print(int(n / 2) - 1)
	else:
		print(int(n / 2))


t = int(input())
answer = []
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		answer.append(int(n / 2) - 1)
	else:
		answer.append(int(n / 2))
for j in answer:
	print(j)


import sys
import math
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


a = int(input())
for efwefe in range(a):
	b = int(input())
	if b < 3:
		print(0)
	elif b % 2 == 0:
		print(int((b - 2) / 2))
	else:
		print(int((b - 1) / 2))


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


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	if n == 1:
		print(0)
	elif n == 2:
		print(0)
	elif n % 2 != 0:
		print(n // 2)
	elif n % 2 == 0:
		print(n // 2 - 1)


import math
n = int(input(''))
for i in range(n):
	x = int(input(''))
	z = x - (x / 2 + 1)
	if z > 0:
		print(math.ceil(z))
	else:
		print(0)


import sys
pin = sys.stdin.readline
pout = sys.stdout.write
ran = range
t = int(pin())
for i in ran(t):
	x = int(pin())
	if x < 3:
		print(0)
		continue
	elif x % 2 == 0:
		print(int(x / 2 - 1))
	else:
		print(int(x / 2))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

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

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

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

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

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for i in range(ii()):
	n = ii()
	if n & 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


n = int(input())
a = i = 0
l = []
for i in range(n):
	l.append(int(input()))
	if l[i] == 0 or l[i] == 1 or l[i] == 2:
		print(0)
	elif l[i] % 2 != 0:
		print(l[i] // 2)
	elif l[i] % 2 == 0:
		print(l[i] // 2 - 1)


from math import ceil

def solve():
	n = int(input())
	print(ceil(n / 2) - 1)
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	print(n // 2 - int(not bool(n % 2)))


t = int(input())
i = 0
while i < t:
	n = int(input())
	if n % 2 == 1:
		m = n - 1
		print(m // 2)
	else:
		print(n // 2 - 1)
	i += 1


import sys
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	n = ri()
	if n & 1 == 1:
		print(int(n - (n + 1) / 2))
	else:
		print(int(n - (n + 2) / 2))


t = int(input())
box = []
count = 0
for i in range(t):
	box.append(int(input()))
for i in box:
	if i % 2 == 1:
		print(i // 2)
	else:
		print(i // 2 - 1)


n = int(input())
e = []
for i in range(n):
	k = int(input())
	if k % 2 != 0:
		d = k // 2
		e.append(d)
	else:
		g = k // 2 - 1
		e.append(g)
for i in range(len(e)):
	print(e[i])


for ii in range(int(input())):
	n = int(input())
	print(n // 2 - 1 + n % 2)


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

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

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	res = 0
	if n <= 2:
		print(0)
	else:
		print(n // 2 if n & 1 else n // 2 - 1)


import sys

def main():
	test_cases = int(sys.stdin.readline())
	for i in range(test_cases):
		num_candies = int(sys.stdin.readline())
		print(int((num_candies - 1) / 2))
main()


t = int(input())
ans = []
for g in range(t):
	n = int(input())
	ans.append((n - 1) // 2)
for i in ans:
	print(i)


t = int(input())
for ts in range(t):
	a = int(input())
	print(max(a // 2 + a % 2 - 1, 0))


t = int(input())
l = list()
for i in range(t):
	n = int(input())
	k = (n - 1) / 2
	l.append(k)
for l in l:
	print(int(l))


testCase = int(input())
candies = list()
count = list()
for i in range(testCase):
	num = int(input())
	candies.append(num)
for i in range(testCase):
	moves = int(candies[i] / 2)
	if candies[i] % 2 == 0 and candies[i] > 2:
		count.append(moves - 1)
	elif candies[i] % 2 != 0 and candies[i] > 2:
		count.append(moves)
	else:
		count.append(0)
print(*count, sep='\n')


t = int(input())
for _ in range(t):
	t1 = int(input())
	if t1 <= 2:
		print(0)
	elif t1 % 2 == 0:
		temp = t1 / 2
		print(int(temp - 1))
	else:
		print(int((t1 - 1) / 2))


t = int(input())
for _ in range(t):
	candie = int(input())
	candie -= 2
	if candie <= 0:
		print(0)
	else:
		half = candie // 2 + 1
		print(candie - half + 1)


import math
try:
	for p in range(int(input())):
		l = int(input())
		if l <= 2:
			print('0')
		else:
			print(math.ceil(l / 2) - 1)
except:
	pass


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

def main():
	for i in range(int(input())):
		print(solve())
main()


def main():
	t = int(input())
	cases = [int(input()) for c in range(t)]
	for c in cases:
		if c <= 2:
			print(0)
		elif c % 2 == 0:
			print(c // 2 - 1)
		else:
			print(c // 2)
main()


dp = [[999999999999] * 100 for i in range(100)]
from math import floor, ceil
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		n -= 1
	print(floor(n / 2))


t = range(int(input('')))
for i in t:
	c = int(input(''))
	print(c // 2 - (1 - c % 2))


from math import ceil as c
n = int(input())
for i in range(n):
	print(c(int(input()) / 2 - 1))


from sys import stdin, stdout
from math import *
for __ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


def read_int():
	return int(input().strip())

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

def solve():
	n = read_int()
	return (n - 1) // 2
T = read_int()
for _ in range(T):
	print(solve())


for test in range(int(input())):
	n = int(input())
	l = 0
	if n % 2 == 0:
		l = n // 2 - 1
	else:
		l = n // 2
	print(l)


import sys
for _ in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	ans = 0
	if n % 2 == 0:
		ans = int(n / 2) - 1
	else:
		ans = int((n - 1) / 2)
	print(ans)


n = int(input())
for x in range(n):
	k = int(input())
	if k == 1 or k == 2:
		print(0)
	else:
		print(int((k - 1) / 2))


testcases = int(input())
all_candies = []
while testcases:
	candies = int(input())
	if candies % 2 == 0:
		all_candies.append(int(candies / 2 - 1))
	else:
		all_candies.append(int(candies / 2 - 0.5))
	testcases -= 1
while len(all_candies) > 0:
	print(all_candies.pop(0))


def NO():
	return print('NO')

def YES():
	return print('YES')

def INT():
	return int(input())

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

def STR():
	return input()

def MAP():
	return map(int, input().split())
import math
for _ in range(INT()):
	n = INT()
	if n <= 2:
		print('0')
	elif not n & 1:
		print(int(n / 2 - 1))
	else:
		print(int(math.floor(n / 2)))


t = int(input())
for _ in range(t):
	a = int(input())
	half = a // 2
	print(a - half - 1)


def res(t):
	for i in range(t):
		n = int(input())
		if n % 2 == 0:
			res = n // 2 - 1
		else:
			res = n // 2
		print(res)
t = int(input())
res(t)


tests = int(input())
for _ in range(tests):
	c = int(input())
	if c == 2 or c == 1:
		print(0)
	elif c % 2 == 0:
		half = c // 2
		print(half - 1)
	else:
		print(c // 2)


count = int(input())
for _ in range(count):
	n = int(input())
	an = n // 2
	if n % 2 == 0:
		an -= 1
	print(an)


n = int(input())
l = []
for i in range(n):
	count = 0
	num = int(input())
	if num % 2 == 0:
		a = num // 2 - 1
	else:
		a = num // 2
	l.append(a)
for i in l:
	print(i)


for i in range(int(input())):
	candy = int(input())
	if candy == 1:
		print(0)
	if candy == 2:
		print(0)
	if candy % 2 == 0 and candy != 2:
		print(candy // 2 - 1)
	elif candy % 2 == 1 and candy != 1:
		print(candy // 2)


import sys
input = sys.stdin.readline
for i in range(int(input())):
	now = int(input())
	print((now - 1) // 2)


import math

def number_of_candies(x):
	if x <= 2:
		return 0
	if x % 2 == 0:
		return int(x / 2 - 1)
	return x // 2
number_of_tests = input()
candies = []
for i in range(int(number_of_tests)):
	candies.append(int(input()))
candies = list(map(number_of_candies, candies))
for i in candies:
	print(i)


from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n % 2:
		print((n + 1) // 2 - 1)
	else:
		print(n // 2 - 1)


def candy(n):
	if n == 2 or n == 1:
		return 0
	if n % 2 == 0 and n > 2:
		mid = n // 2
		return mid - 1
	else:
		mid = n // 2
		return mid
t = int(input())
for i in range(t):
	n = int(input())
	print(candy(n))


import sys

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line.rstrip())
	for i in range(1, len(q)):
		if int(q[i]) % 2 == 0:
			print(int(q[i]) // 2 - 1)
		else:
			print(int(q[i]) // 2)
main()


from sys import stdin, stdout

def write(_s):
	stdout.write(_s)

def writeint(_s):
	stdout.write(str(_s))

def writelist(_l):
	stdout.write(' '.join(_l))

def read():
	return stdin.readline().strip().split(' ')

def readint():
	return int(stdin.readline().strip())

def readints():
	return map(int, stdin.readline().strip().split(' '))
t = readint()
while t:
	n = readint()
	if n % 2 == 0:
		writeint((n - 1) // 2)
	else:
		writeint(n // 2)
	write('\n')
	t -= 1


n = int(input())
while n > 0:
	n -= 1
	a = int(input())
	print((a + 1) // 2 - 1)


import math
t = int(input())
for _ in range(t):
	x = math.ceil(int(input()) / 2)
	print(x - 1)


a = int(input())
j = 1
while j <= a:
	c = int(input())
	if c % 2 == 0:
		print(c // 2 - 1)
	else:
		print(c - c // 2 - 1)
	j += 1


def func(n):
	if n <= 2:
		return 0
	elif n % 2 != 0:
		a = n // 2 + 1
		return n - a
	else:
		a = n // 2
		return n - a - 1
t = int(input())
for _ in range(t):
	n = int(input())
	print(func(n))


import sys
import math
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	k = math.ceil(n / 2)
	ans = n - k
	if n % 2 == 0:
		print(ans - 1)
	else:
		print(ans)


from sys import stdin, stdout
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 2 == 0:
		k = n // 2 - 1
	else:
		k = n // 2
	print(k)


t = int(input())
for _ in range(t):
	x = int(input())
	if x == 1:
		print(0)
	elif x % 2 == 0:
		print(x // 2 - 1)
	else:
		print(x // 2)


from math import ceil
num = int(input())
ans = ''
for i in range(num):
	x = int(input())
	ans += str(ceil(x / 2) - 1) + '\n'
print(ans)


test = int(input())
for _ in range(test):
	num = int(input())
	temp = num // 2
	print(num - (temp + 1))


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	print(n // 2 - (n % 2 == 0))


try:
	T = int(input())
	for t in range(T):
		n = int(input())
		ans = 0
		if n == 0:
			ans = 0
		elif n % 2 == 0:
			ans = n // 2 - 1
		else:
			ans = n // 2
		print(ans)
except:
	pass


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	elif n % 2 != 0:
		x = math.ceil(n / 2)
		print(n - x)
	elif n % 2 == 0:
		print(int(n / 2 - 1))


for _ in range(int(input())):
	num = int(input())
	if num // 2 == num - num // 2:
		print(num // 2 - 1)
	else:
		print(num // 2)


def possiblities(can):
	if can == 1 or can == 2:
		print('0')
	elif can == 0:
		print('0')
	elif can % 2 == 0:
		can = can - 2
		man = str(can / 2)
		index = man.find('.')
		man2 = man[:index]
		print(man2)
	else:
		man = str(can / 2)
		index = man.find('.')
		man2 = man[:index]
		print(man2)
candies = []
cases = int(input())
i = 0
while i < cases:
	candies.append(int(input()))
	i = i + 1
t = 0
while t < len(candies):
	possiblities(candies[t])
	t = t + 1


import sys, math, random
sys.setrecursionlimit(20000000)
input = sys.stdin.readline

def ina():
	return int(input())

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

def instr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = ina()
for i in range(t):
	n = ina()
	if n % 2 == 0:
		ans = n // 2
		ans -= 1
		print(ans)
	else:
		ans = n // 2
		print(ans)


from math import floor
for i in range(int(input())):
	a = int(input())
	if a % 2 == 1:
		if a == 1 or a == 2:
			print(0)
		else:
			print(floor(a / 2))
	elif a == 1 or a == 2:
		print(0)
	else:
		print(floor(a / 2) - 1)


for z in range(int(input())):
	n = int(input())
	count = 0
	alice = 0
	bet = 0
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000010
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]
spf[0] = spf[1] = -1

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	n = int(input())
	if n % 2:
		print(n // 2)
	else:
		print(n // 2 - 1)


n = int(input())
cand = [int(input()) for i in range(n)]
for i in cand:
	print((i - 1) // 2)


def ans(n):
	if n % 2 == 0:
		return n // 2 - 1
	return n // 2
n = int(input())
for i in range(n):
	m = int(input())
	print(ans(m))


import os
import sys
from io import BytesIO, IOBase
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

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

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	for _ in range(N()):
		n = N()
		res = n // 2 - 1 if n % 2 == 0 else n // 2
		if res > 0:
			print(res)
		else:
			print(0)
main()


times = int(input())
ans = []
for i in range(times):
	x = int(input())
	if x <= 2:
		ans.append(0)
	elif x % 2 == 0:
		ans.append(x / 2 - 1)
	else:
		ans.append(x // 2)
for i in ans:
	print(int(i))


import random, math
from copy import deepcopy as dc

def input_test():
	for _ in range(int(input())):
		n = int(input())
		if n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
input_test()


import random as rn
n = int(input())
i = 0
for i in range(0, n):
	a = int(input())
	if a <= 2:
		a = 0
	elif a % 2 == 0:
		a = int(a / 2) - 1
	else:
		a = int(a / 2)
	print(a)


from sys import stdin, stdout
for testcases in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = n - 1
	b = 1
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


import math
a = int(input())
for i in range(a):
	b = int(input())
	if b % 2 == 0:
		print(int(b / 2 - 1))
	else:
		print(math.floor(b / 2))


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	print((n - 1) // 2)


for ad in range(int(input())):
	n = int(input())
	print(int((n - 1) // 2))


import math
t = int(input())
for c in range(t):
	n = int(input())
	print(max(math.ceil(n / 2) - 1, 0))


from math import floor
x = int(input())
for i in range(x):
	n = int(input())
	print(floor(n - 1) // 2)


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


def solve():
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
T = int(input())
for i in range(T):
	solve()


def solve(n):
	if n == 0 or n == 2 or n == 1:
		return 0
	if n % 2 == 0:
		return n // 2 - 1
	else:
		return (n - 1) // 2
test = int(input())
for i in range(test):
	n = int(input())
	print(solve(n))


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	ans = n // 2
	if n % 2 == 0:
		ans -= 1
	print(ans)


n = int(input())
while n:
	n -= 1
	m = int(input())
	if m // 2 < m / 2:
		print(m // 2)
	else:
		print(m // 2 - 1)


def main():
	cc = int(input())
	for i in range(cc):
		candies = int(input())
		if candies == 1 or candies == 2:
			print(0)
			continue
		if candies % 2 == 0:
			candies -= 1
		print(candies // 2)
main()


import math

def fun(t):
	for i in range(t):
		n = int(input())
		if n <= 2:
			print(0)
		else:
			print(n - n // 2 - 1)
t = int(input())
fun(t)


def alt_subsequence(n):
	return int((n - 1) / 2)
t = int(input())
for t_itr in range(t):
	n = int(input())
	result = alt_subsequence(n)
	print(result)


n = int(input())
for i in range(n):
	k = int(input())
	print(k // 2 - int(k % 2 == 0))


t = int(input())
for _ in range(t):
	x = int(input())
	print(max(0, (x + 1) // 2 - 1))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def bool_to_str(flag):
	if flag:
		return 'YES'
	else:
		return 'NO'
tests = inp()
for test in range(tests):
	n = inp()
	print(int((n - 1) / 2))


def main():
	try:
		t = input()
		t = int(t)
		data = []
		if not 1 <= t <= 10 ** 4:
			exit(1)
		for _ in range(t):
			temp = input()
			temp = int(temp)
			if not 1 <= temp <= 2 * 10 ** 9:
				exit(1)
			result = doLogic(temp)
			data.append(result)
		for j in range(len(data)):
			print(data[j])
	except:
		print('no')

def doLogic(data):
	if data <= 2:
		data = 0
	elif data % 2 == 0:
		data = data // 2 - 1
	else:
		data = (data - 1) // 2
	return data
main()


for aww in range(int(input())):
	a = int(input())
	print(max(0, a // 2 - 1 if a % 2 == 0 else a // 2))


for _ in range(int(input())):
	a = int(input())
	print((a - 1) // 2)


t = int(input())
for i in range(t):
	n = int(input())
	r = n // 2 if n % 2 == 1 else n // 2 - 1
	print(r)


t = int(input())
p = 0
while p < t:
	x = int(input())
	i = x - 1
	y = i - int(i / 2) + 1
	u = x - y
	p = p + 1
	print(u)


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


import collections

def solve(n):
	if n <= 2:
		return 0
	if n & 1:
		return (n - 1) // 2
	else:
		return n // 2 - 1
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	print(solve(n))


from math import *
a = int(input())
for x in range(a):
	b = int(input())
	if b == 1 or b == 2:
		print(0)
	elif b % 2 == 0:
		print(int((b - 1) // 2))
	else:
		print(int(b // 2))


t = int(input())
for _ in range(t):
	n = int(input())
	half = n // 2 + 1
	total = n - half
	print(total)


t = int(input())
while t != 0:
	candies = int(input())
	t -= 1
	if candies % 2 == 0:
		print(candies // 2 - 1)
	else:
		print(candies // 2)


import math

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

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


n = int(input())
for each in range(n):
	original = int(input())
	x = original // 2
	if original % 2 == 0:
		x -= 1
	print(x)


t = int(input())
for w in range(t):
	n = int(input())
	print(n - n // 2 - 1)


def main():
	for _ in range(int(input())):
		n = int(input())
		if n == 1 or n == 2:
			print('0')
		elif n % 2 != 0:
			print(n // 2)
		else:
			print(n // 2 - 1)
main()


import math
try:
	for ii in range(int(input())):
		n = int(input())
		if n < 2:
			print('0')
		else:
			print(math.ceil(n / 2) - 1)
except:
	pass


a = int(input())
f = []
for i in range(a):
	b = int(input())
	if b % 2 == 0:
		c = b / 2
		f.append(int(c - 1))
	elif b % 2 != 0:
		d = int(b // 2 + 1)
		e = int(b // 2)
		f.append(int(e))
print('\n'.join(map(str, f)))


t = int(input())
for each_t in range(t):
	i = int(input())
	if i < 3:
		print(0)
	elif i & 1 == 1:
		print(i // 2)
	else:
		print(i // 2 - 1)


t = int(input())
ans = []
for i in range(0, t):
	n = int(input())
	if n == 1 or n == 2:
		ans.append(0)
	else:
		ans.append((n - 1) // 2)
for i in range(0, t):
	print(ans[i])


n = int(input())
list = []
for i in range(n):
	a = int(input())
	if a % 2 == 0:
		k = a // 2 - 1
	elif a % 2 == 1:
		k = (a - 1) // 2
	list.append(k)
for x in list:
	print(x, end='\n')


n = int(input())
t = 0
l = []
for f in range(n):
	h = int(input())
	l.append(h)
for i in l:
	if i % 2 == 0:
		if i > 1:
			t = int(i / 2) - 1
		else:
			t = 0
	elif i > 1:
		t = int(i / 2)
	else:
		t = 0
	print(t)


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


T = int(input())
for test in range(T):
	n = int(input())
	print((n - 1) // 2)


x = int(input())
for i in range(x):
	n = int(input())
	j = n // 2 + 1
	k = n - 1
	print(k - j + 1)


n = int(input())
for i in range(n):
	k = int(input())
	if k < 2:
		print(0)
		continue
	val = k - k // 2
	print(val - 1)


from sys import stdout
import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for t in range(int(input())):
	stdout.write(str((int(input()) - 1) // 2) + '\n')


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	n = int(input())
	if n & 1:
		print(n // 2)
	else:
		print(n // 2 - 1)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


t = int(input())
lst = list()
for i in range(t):
	lst.append(input())
for j in lst:
	x = int(j) // 2
	if int(j) % 2:
		print(x)
	else:
		print(x - 1)


for _ in range(int(input())):
	x = int(input())
	print(x // 2 + x % 2 - 1)


n = int(input())
k = []
i = 0
while i < n:
	r = int(input())
	k.append(r)
	i += 1
for s in k:
	print((s - 1) // 2)


from sys import stdin
n = int(stdin.readline())
for _ in range(n):
	nums = int(stdin.readline().rstrip())
	if nums % 2 == 0:
		print(nums // 2 - 1)
	else:
		print(nums // 2)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	n = (n - 1) // 2
	stdout.write(str(n) + '\n')


n = int(input())
t = n
while t > 0:
	a = int(input())
	if a < 3:
		ans = 0
		print(int(ans))
	else:
		ans = a / 2
		if a % 2 == 0:
			ans = ans - 1
		print(int(ans))
	t = t - 1


t = int(input())
s = []
for hhh in range(0, t):
	n = int(input())
	a1 = n - n // 2
	a2 = n - 1
	m = a2 - a1
	if n % 2 == 0:
		s.append(m)
	else:
		s.append(m + 1)
for i in s:
	print(i)


import sys
input = sys.stdin.buffer.readline

def array_to_string(a):
	s = ''
	for i in a:
		s += str(i)
	return s
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	print(n - n // 2 - 1)


a = int(input())
for i in range(a):
	b = int(input())
	print((b - 1) // 2)


def num_candles(n):
	if n % 2 == 0:
		ans = int(n / 2 - 1)
	else:
		ans = int(n / 2)
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	print(num_candles(n))


def modinv(n, p):
	return pow(n, p - 2, p)

def main():
	for case in range(int(input())):
		n = int(input())
		if n % 2 != 0:
			print(n // 2)
		else:
			print((n - 1) // 2)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


p = int(input())
for i in range(p):
	x = int(input())
	if x % 2 != 0:
		u = (x - 1) // 2
		print(u)
	else:
		t = x // 2 - 1
		print(t)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print('0')
	else:
		d = n - 1
		e = d // 2
		print(e)


import math
n1 = int(input(), base=10)
for i in range(n1):
	k = int(input(), base=10)
	if k % 2 == 0:
		print(int(k - (k / 2 + 1)))
	else:
		print(k - math.ceil(k / 2))


for t in range(int(input())):
	n = int(input())
	s = 0
	m = n // 2 + 1
	a = m
	b = n - m
	if m == n or b >= a or a == 0 or (b == 0):
		s = 0
	else:
		s = n - m
	print(s)


t = int(input())
result = []
while t:
	value = int(input())
	if 1 <= value <= 2:
		result.append(0)
	elif value % 2:
		result.append(value // 2)
	else:
		result.append(value // 2 - 1)
	t -= 1
for res in result:
	print(res)


for _ in range(int(input())):
	n = int(input())
	start = n // 2 + 1
	end = n - 1
	print(max(0, end - start + 1))


from sys import stdin, stdout
t = int(stdin.readline().strip())
for line in stdin.readlines():
	num = int(line.strip())
	max_ways = (num - 1) // 2
	stdout.write(str(max_ways) + '\n')


from sys import stdin
n = 0
for i in range(int(stdin.readline())):
	n = int(stdin.readline())
	print((n - (2 - n % 2)) // 2)


def inout():
	cases = int(input())
	for i in range(cases):
		candies = int(input())
		middle = candies // 2 + 1
		print(candies - middle)
inout()


p = int(input())
for i in range(p):
	q = int(input())
	if q <= 2:
		print('0')
	if q > 2:
		if q % 2 == 0:
			print(int(q / 2) - 1)
		if q % 2 != 0:
			print(int(q / 2))


from math import floor, ceil
for _ in range(int(input())):
	n = int(input())
	if n <= 2:
		print(0)
	else:
		a = ceil(n / 2)
		print(a - 1)


t = int(input())
tab = []
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		x = n / 2 - 1
	else:
		x = n / 2 - 0.5
	if x < 1:
		x = 0
	tab.append(int(x))
for z in tab:
	print(z)


t = int(input())
for q in range(t):
	n = int(input())
	d = n // 2 + 1
	print(n - d)


testcases = int(input())
import math
for i in range(testcases):
	n = int(input())
	answ = math.ceil(n / 2 - 1)
	print(answ)


for i in range(int(input())):
	a = int(input())
	print((a // 2 if a % 2 != 0 else a // 2 - 1) if a != 1 and a != 2 and (a != 0) else 0)


nt = int(input())
for c in range(nt):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


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


n = int(input())
for i in range(n):
	n2 = int(input())
	print((n2 - 1) // 2)


t = int(input())
while t > 0:
	x = int(input())
	x = x - 1
	print(x // 2)
	t = t - 1


num = int(input())
ans = []
for i in range(0, num):
	candies = int(input())
	if candies % 2 == 0:
		candies -= 1
	ans.append(int(candies / 2))
for a in ans:
	print(a)


for n in [*open(0)][1:]:
	print(int(n) - 1 >> 1)


def calc(candy):
	if candy == 1 or candy == 2:
		return 0
	elif candy % 2 == 0:
		return int(candy / 2 - 1)
	return int(candy / 2)
t = int(input())
for i in range(t):
	candy = int(input())
	output = calc(candy)
	print(output)


t = int(input())
while t != 0:
	n = int(input())
	if not n & 1:
		n -= 1
	print(int(n // 2))
	t -= 1


t = int(input())
while t:
	a = int(input())
	if a < 3:
		print(0)
	else:
		print((lambda : a // 2 - 1, lambda : a // 2)[a % 2 != 0]())
	t -= 1


def value(n):
	if n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2
res = []
m = int(input())
for i in range(m):
	res.append(value(int(input())))
for v in res:
	print(v)


a = int(input())
b = 0
i = 0
while i < a:
	b = int(input())
	if b > 2:
		print((b - 1) // 2)
	else:
		print(0)
	i = i + 1


b = list()
for i in range(int(input())):
	a = int(input())
	if a % 2 == 0:
		b.append(int(a / 2 - 1))
	else:
		b.append(int(a / 2))
for i in b:
	print(i)


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	ans = n - 1 - x
	print(ans)


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

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

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	n = read_int()
	ans = n // 2 if n % 2 != 0 else n // 2 - 1
	print(ans)


import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

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

def instr():
	s = input()
	return list(s[:len(s)])

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

def def_value():
	return False
t = inp()
for _ in range(t):
	n = inp()
	res = n - (n // 2 + 1)
	print(res)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n % 2 == 0:
			n1 = int(n / 2 + 1)
			print(n - n1)
		else:
			n1 = int(n / 2 + 1)
			print(n - n1)
main()


t = int(input())
p = []
for j in range(t):
	i = 0
	n = int(input())
	if n % 2 == 0:
		i = n / 2 - 1
		p.append(round(i))
	else:
		i = n // 2
		p.append(round(i))
for k in range(len(p)):
	print(p[k])


a = []
ans = []
for i in range(int(input())):
	a.append(int(input()))
for i in range(len(a)):
	if a[i] % 2 == 1:
		ans.append(int((a[i] - 1) / 2))
	elif a[i] % 2 == 0:
		ans.append(int((a[i] - 2) / 2))
for i in ans:
	print(i)


t = int(input())
out = list()
for item in range(t):
	n = int(input())
	if n % 2 == 1:
		out.append(int(n / 2))
	elif n % 2 == 0:
		out.append(int(n / 2 - 1))
for item in out:
	print(item)


test = int(input())
result = 0
i = 1
while i <= test:
	case = input()
	num = int(case)
	if num % 2 == 0:
		result = num - num / 2 - 1
	else:
		result = num / 2
	print(int(result))
	i = i + 1


for case in range(int(input())):
	n = int(input())
	ans = (n + 1) // 2 - 1
	print(ans)


T = int(input())
for tc in range(T):
	n = int(input())
	ans = n // 2
	if not n % 2:
		ans -= 1
	print(ans)


try:
	t = int(input())
	for i in range(t):
		n = int(input())
		if n < 3:
			print('0')
		else:
			a = n // 2
			if n % 2 != 0:
				print(a)
			else:
				print(a - 1)
except:
	pass


test_cases = int(input())
results = []
for i in range(test_cases):
	candies = int(input())
	if candies > 2 and candies <= 2 * 10 ** 9:
		results.append(int((candies - 1) / 2))
	else:
		results.append(0)
for i in results:
	print(i)


t = int(input())
cases = []
for i in range(t):
	n = int(input())
	if n >= 2:
		cases.append((n - 1) // 2)
	else:
		cases.append(0)
for c in cases:
	print(c)


from sys import stdin
a = stdin.readline()
a = int(a)
for b in range(0, a):
	a = stdin.readline()
	a = int(a)
	if a % 2 == 0:
		print(int(a / 2 - 1))
	else:
		print(int((a - 1) / 2))


import sys
import math
input = lambda : sys.stdin.readline().strip()

def ncr(n, r):
	num = 1
	den = 1
	for i in range(r):
		num = num * (n - i)
		den = den * (i + 1)
	return num // den
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 2:
		n = n // 2
	else:
		n = n // 2 - 1
	print(ncr(n, 1))


lst = [int(input()) for _ in range(int(input()))]
for i in lst:
	if i % 2 == 0:
		print(i // 2 - 1)
	else:
		print(i // 2)


n = int(input())
b = []
a = [int(input()) for i in range(n)]
for i in range(n):
	k1 = int(a[i] / 2 + 1)
	k2 = a[i] - k1
	print(abs(k2))


for xyz in range(0, int(input())):
	n = int(input())
	print(max(0, (n - 1) // 2))


t = int(input())
for i in range(t):
	n = int(input())
	r = int(n % 2)
	d = int(n / 2)
	if r == 0:
		print(d - 1)
	elif r == 1:
		print(d)


n_cases = int(input())
for case_num in range(1, n_cases + 1):
	n = int(input())
	print((n + 1) // 2 - 1)


import math
T = int(input())
for t in range(T):
	n = int(input())
	if n % 2:
		print(int(n / 2))
	else:
		print(int(n / 2) - 1)


n = int(input())
li = []
for i in range(0, n):
	k = int(input())
	if k == 1 or k == 2:
		sol = 0
	else:
		m = int(k / 2)
		if k % 2 == 0:
			sol = m - 1
		else:
			sol = m
	print(sol)


import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	print(n // 2 - 1 + n % 2)


import math
t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
for num in a:
	print(int(math.floor(num - 1) / 2))


from sys import stdin, stdout
for test in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n == 1 or n == 2:
		stdout.write('0\n')
	elif n % 2 == 0:
		stdout.write(str(n // 2 - 1) + '\n')
	else:
		stdout.write(str(n // 2) + '\n')


for qq in range(int(input())):
	n = int(input())
	print(n // 2 - (n % 2 == 0))


import sys
from collections import defaultdict, deque
from math import sqrt

def input():
	return sys.stdin.readline()[:-1]

def solve():
	n = int(input())
	if n == 1:
		print(0)
		return
	if n % 2:
		print(n // 2)
	else:
		print(n // 2 - 1)
t = int(input())
for _ in range(t):
	solve()


import math
t = int(input())
while t is not 0:
	n = int(input())
	if n < 3:
		print(0)
	elif n % 2 is 0:
		print(math.floor(n / 2 - 1))
	else:
		print(math.floor(n / 2))
	t = t - 1


n = int(input())
for i in range(n):
	print(list(map(lambda i: (i - 1) // 2, [int(input())]))[0])


rw = int(input())
for ewqr in range(rw):
	n = int(input())
	print((n + 1) // 2 - 1)


import math
import random
import sys
import time
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	print(int((n - 1) / 2))


def main():
	d = int(input())
	for i in range(d):
		cc = int(input())
		print(cc // 2 if cc % 2 != 0 else cc // 2 - 1)
main()


t = int(input())
for cases in range(0, t):
	n = int(input())
	res = -1 if n % 2 == 0 else 0
	res += n // 2
	print(res)


import sys
t = int(sys.stdin.readline().split()[0])
tests = []
for line in sys.stdin:
	for word in line.split():
		tests.append(int(word))
for test in tests:
	if test % 2 == 0:
		print(int(test / 2) - 1)
	else:
		print(int(test / 2))


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


import math
case = int(input())
for i in range(0, case):
	upperBound = int(input()) - 1
	lowerBound = 1
	difference = upperBound - lowerBound
	if upperBound < 2:
		difference = 0
	steps = math.ceil(difference / 2)
	print(steps)


from collections import Counter
s = 'abcdefghijklmnopqrstuvwxyz' * 200
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


def testcase():
	n = int(input())
	if n <= 2:
		return 0
	return (n - 1) // 2
for _ in range(int(input())):
	print(testcase())


cnt = int(input())
for i in range(cnt):
	inp = int(input())
	result = (inp + 1) // 2 - 1
	print(result)


import sys
from sys import stdout

def iters():
	return range(int(input().split(' ')))

def solve(n, k):
	return n + k
testcases = int(sys.stdin.readline())
for i in range(testcases):
	a = int(sys.stdin.readline())
	stdout.write(str(int((a - 1) / 2)) + '\n')


import math
from collections import Counter
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(int(input())):
	n = I()
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


import math
p = input()
n = int(p)
for i in range(0, n, 1):
	p = input()
	a = int(p)
	p = 0
	if a > 2:
		if a % 2 == 0:
			c = int(a - 2)
			p = int(c / 2)
		else:
			c = int(a - 1)
			p = int(c / 2)
	print(p)


import random as ran
n = int(input())
for i in range(n):
	s = int(input())
	if s % 2 == 0:
		print(int(s / 2) - 1)
	else:
		print(int(s / 2))


def distribute(candies):
	return candies // 2 + candies % 2 - 1
test_number = int(input())
for _ in range(test_number):
	candies = int(input())
	result = distribute(candies)
	print(result)


test = int(input())
while test != 0:
	n = int(input())
	if n == 0 or n == 1:
		print(0)
	elif n % 2 == 1:
		x = int(n / 2)
		print(x)
	elif n % 2 == 0:
		x = int(n / 2) - 1
		print(x)
	test -= 1


def solve(n):
	return (n - 1) // 2
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))
assert solve(7) == 3
assert solve(1) == 0
assert solve(2) == 0
assert solve(3) == 1
assert solve(2000000000) == 999999999
assert solve(763243547) == 381621773


a = int(input())
for k in range(a):
	b = int(input())
	c = b // 2 + 1
	print(b - c)


MOD = 10 ** 9 + 7

def main():
	test = int(input())
	for iteration in range(test):
		n = int(input())
		if n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
main()


import math
n = int(input())
lst = []
for i in range(0, n):
	ele = int(input())
	lst.append(ele)
for ele in lst:
	if ele > 2:
		if ele % 2 == 0:
			x = math.floor(ele / 2) - 1
			print(x)
		else:
			x = math.floor(ele / 2)
			print(x)
	else:
		print('0')


a = int(input())
l = []
for x in range(a):
	n = int(input())
	if n % 2 == 0:
		l.append(n // 2 - 1)
	else:
		l.append(n // 2)
for y in l:
	print(y)


s = int(input())
for i in range(s):
	l = int(input())
	if l <= 2:
		print(0)
	elif l % 2 == 0:
		print(l // 2 - 1)
	elif l % 2 != 0:
		print(l // 2)


t = int(input(''))
for i in range(t):
	n = list(map(int, input('').split()))
	for e in n:
		if e == 0:
			print('0')
		elif e == 1:
			print('0')
		elif e % 2 == 0:
			print(e // 2 - 1)
		else:
			print((e - 1) // 2)


l = []
for i in range(int(input())):
	x = int(input())
	s = x // 2
	q = s + 1
	w = x - q
	l.append(w)
for i in l:
	print(i)


T = int(input())
results = []
for case in range(1, T + 1):
	n = int(input())
	middle = n // 2
	if n % 2 == 0:
		middle -= 1
	results.append(middle)
for result in results:
	print(result)


import math
for i in range(int(input())):
	n = int(input())
	ans = math.ceil(n / 2) - 1
	if ans < 0:
		print(0)
	else:
		print(ans)


def sol(n):
	if n <= 2:
		print(0)
		return
	print(int(n / 2) - 1 if n % 2 == 0 else int(n / 2))
	return
for i in range(int(input())):
	sol(int(input()))


import math
x = int(input())
for i in range(x):
	data = int(input())
	count = data / 2
	if count.is_integer():
		count = count - 1
		count = int(count)
	else:
		count = int(count)
	print(count)


def tran(n):
	n = n - 2
	if n > 0:
		return int((n - 1) / 2) + 1
	else:
		return 0
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	r = tran(n)
	ans.append(r)
for i in ans:
	print(i)


n = int(input())
s = [int(input()) for i in range(n)]
for v in s:
	if v % 2 == 1:
		print(v // 2)
	else:
		print(v // 2 - 1)


from collections import defaultdict as df
from sys import stdin, stdout
t = int(input())
for i in range(t):
	n = int(stdin.readline())
	print((n + 1) // 2 - 1)


try:
	t = int(input())
	while t:
		n = int(input())
		if n <= 2:
			print('0')
		elif n % 2 == 0:
			print(int(n / 2 - 1))
		else:
			print(int(n / 2))
	t = t - 1
except:
	pass


def gen_val(n):
	if n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2
t = int(input())
for _ in range(t):
	n = int(input())
	print(gen_val(n))


def f(p):
	return (p - 1) // 2
k = int(input())
r = []
for i in range(0, k):
	p = int(input())
	r.append(f(p))
for i in r:
	print(i)


t = int(input())
l = []
l1 = []
for q in range(t):
	x = int(input())
	l.append(x)
for i in range(t):
	m = 0
	y = l[i]
	if y % 2 != 0:
		m = m + y // 2
	else:
		m = m + y // 2 - 1
	l1.append(m)
for j in range(t):
	print(l1[j])


from sys import stdin, stdout
from collections import defaultdict, Counter
from functools import lru_cache
from math import gcd, floor, ceil

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()
t = iint()
for _x in range(t):
	n = iint()
	print((n - 1) // 2)


def func(n):
	for _ in range(n):
		m = int(input())
		if m % 2 == 0:
			k.append(str(m // 2 - 1))
		else:
			k.append(str(m // 2))
	print('\n'.join(k))
k = []
func(int(input()))


num = int(input())
cases = []
for i in range(num):
	cases.append(int(input()))
for case in cases:
	print(int((case - 1) / 2))


from collections import Counter
from math import ceil
for _ in range(int(input())):
	n = int(input())
	(a, b) = (n - 1, 1)
	c = 0
	print(ceil(n / 2) - 1)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n == 1 or n == 2:
			print(0)
		elif n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
main()


number_test = int(input())
for k in range(number_test):
	inp = int(input())
	if inp % 2 == 1:
		nb_pos = inp // 2
	else:
		nb_pos = max(inp // 2 - 1, 0)
	print(nb_pos)


t = int(input())
c = []
for i in range(t):
	a = int(input())
	if a == 1 or a == 2:
		count = 0
	elif a % 2 == 0:
		count = a // 2 - 1
	else:
		count = a // 2
	c.append(count)
for i in c:
	print(i)


T = int(input())
for cs in range(T):
	n = int(input())
	print((n - 1) // 2)


import sys
import os
from io import BytesIO, IOBase

def cel(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
for _ in range(ii()):
	n = ii()
	if n & 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


P = int(input())
for p in range(P):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


a = int(input())
for i in range(a):
	number_of_candies = int(input())
	if number_of_candies > 2:
		if number_of_candies % 2 == 0:
			output = number_of_candies // 2 - 1
		else:
			output = number_of_candies // 2
		print(output)
	else:
		print('0')


t = input()
t = int(t)
while t:
	N = input()
	N = int(N)
	ans = N - 1 - int(N / 2)
	print(ans)
	t = t - 1


k = int(input())
for i in range(k):
	j = int(input())
	if j <= 2:
		print(0)
	else:
		a = j // 2 + 1
		res = j - a
		print(res)


t = int(input())
for _ in range(t):
	candies = int(input())
	if candies % 2 == 0:
		b = candies / 2 - 1
	else:
		b = int(candies / 2)
	if candies < 1:
		print(0)
	else:
		print(int(b))


import math
for _ in range(int(input())):
	m = int(input())
	if m < 3:
		print(0)
	else:
		print(math.ceil(m / 2) - 1)


t = int(input())
for m in range(t):
	n = int(input())
	print((n - 1) // 2)


tc = int(input())
t = 0
while t < tc:
	t += 1
	n = int(input())
	n -= 1
	b = int(n / 2)
	print(b)


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

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

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

def modInverse(p, a, m):
	return p * pow(a % m, m - 2, m) % m
for _ in range(int(input())):
	n = int(input())
	if n % 2 != 0:
		print(n // 2)
	else:
		print(n // 2 - 1)


l = []
for j in range(0, int(input())):
	l.append(int(input()))
	if l[j] % 2 == 0:
		print(l[j] // 2 - 1)
	else:
		print(l[j] // 2)


howm = int(input())
for n in range(howm):
	cand = int(input())
	if cand % 2 == 0 and cand > 0:
		print(int(cand / 2) - 1)
	elif cand % 2 != 0 and cand > 0:
		print(int(cand / 2))
	else:
		print('0')


t = int(input())
for k in range(t):
	n = int(input())
	print((n - 1) // 2)


t = int(input())
for tt in range(0, t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(round(n / 2) - 1)
	else:
		print(round((n - 1) / 2))


def waysNumber(count):
	if count % 2 == 0:
		return count // 2 - 1
	else:
		return count // 2
t = int(input())
answers = []
for i in range(t):
	data = int(input())
	answers.append(waysNumber(data))
for ans in answers:
	print(ans)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	print(n - n // 2 - 1)


from math import ceil

def solve(n):
	if n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		ans = solve(n)
		print(ans)
main()


combinations = []
for i in range(int(input())):
	x = int(input())
	combinations.append((x - 1) / 2)
for i in combinations:
	print(int(i))


import math
t = int(input())
for i in range(t):
	n = int(input())
	ways = math.floor((n - 1) / 2)
	print(ways)


def main():
	t = int(input())
	outputs = []
	for i in range(t):
		n = int(input())
		if n % 2 != 0:
			outputs.append(int(n / 2))
		else:
			outputs.append(int(n / 2 - 1))
	for o in outputs:
		print(o)
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		left = n // 2 + 1
		right = n - 1
		print(right - left + 1)
	else:
		left = n // 2 + 1
		right = n - 1
		print(right - left + 1)


def candy(n):
	if n == 1 or n == 2:
		return 0
	elif n % 2 == 0:
		return int(n / 2 - 1)
	else:
		return int((n - 1) / 2)
n = int(input())
for i in range(n):
	num = int(input())
	print(candy(num))


t = int(input())
s = 0
for i in range(t):
	s = (int(input()) - 1) // 2
	print(s)


def main():
	for _ in range(int(input())):
		n: int = int(input())
		(x, rem) = divmod(n, 2)
		if rem == 0:
			print(x - 1)
		else:
			print(x)
main()


import sys

def func():
	return
for _ in range(int(input())):
	n = int(input())
	if n >= 3:
		print(n - n // 2 - 1)
	else:
		print(0)


def numWays(x):
	if x == 1:
		return 0
	else:
		return x - (x // 2 + 1)
t = int(input())
for _ in range(t):
	n = int(input())
	print(numWays(n))


w = int(input())
for q in range(w):
	a = int(input())
	if a == 1 or a == 2 or a == 0:
		print(0)
	elif a % 2 == 0:
		print(a // 2 - 1)
	else:
		print(a // 2)


test = int(input())
k = []
while test != 0:
	n = int(input())
	count = (n - 1) / 2
	count = int(count)
	value = str(count)
	k.append(value)
	test -= 1
for j in k:
	print(j)


n1 = input()
t = int(n1)
lst = list()
while t > 0:
	lst.append(int(input()))
	t = t - 1
for num in lst:
	if num % 2 == 0:
		y = num / 2 - 1
		if y >= 0:
			print(int(y))
	else:
		y = (num - 1) / 2
		if y >= 0:
			print(int(y))


q = int(input())
for i in range(q):
	a = int(input())
	if a % 2 == 0:
		print(a // 2 - 1)
	elif a % 2 == 1:
		print((a - 1) // 2)


t = int(input())
result = list()
for test_case in range(t):
	n = int(input())
	result.append((n - 1) // 2)
for i in result:
	print(i)


def candies():
	t = int(input())
	while t != 0:
		amount = int(input())
		result = round(amount / 2 - 0.6)
		print(result)
		t -= 1
candies()


from sys import stdin

def solve(tc):
	n = int(stdin.readline().strip())
	if n % 2 == 0:
		n -= 1
	half = n // 2
	print(half)
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


import math
n = int(input())
candies = []
for i in range(0, n):
	x = float(input())
	candies.append(x)
for i in candies:
	x = int(i / 2)
	if x == i / 2:
		x = x - 1
	if x < 0:
		print('0')
	else:
		print(x)


import sys
import math
import heapq
from collections import defaultdict, deque
input = sys.stdin.readline

def r():
	return int(input())

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

def rl():
	return list(map(int, input().split()))
for i in range(r()):
	a = r()
	if a & 1:
		print(a // 2)
		continue
	print(a // 2 - 1)


t = int(input())
for case in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__

def go():
	n = int(input())
	return (n - 1) // 2
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


t = int(input())
for testcase in range(t):
	n = int(input())
	print((n - 1) // 2)


numcases = int(input())

def solve():
	count = int(candies / 2) - 1
	if candies % 2 == 1:
		count = count + 1
	return count
for i in range(numcases):
	candies = int(input())
	print(solve())


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	if n <= 2:
		a += 1
		print(0)
	z = int(n / 2)
	x = n % 2
	if x == 1 and a == 0:
		print(z)
	if x == 0 and a == 0:
		print(z - 1)


tc = int(input())
for t in range(tc):
	n = int(input())
	ans = int((n - 1) / 2)
	print(ans)


test_cases = [int(input()) for i in range(int(input()))]
for t in test_cases:
	ans = 0
	if t >= 3:
		ans = int(t - (t / 2 + 1) if t % 2 == 0 else t - (t + 1) / 2)
	print(ans)


testCases = int(input())
for i in range(0, testCases):
	candies = int(input())
	if candies % 2 == 0:
		print(candies // 2 - 1)
	else:
		print(candies // 2)


test_case = int(input())
while test_case:
	number_of_chocolate = int(input())
	print((number_of_chocolate - 1) // 2)
	test_case -= 1


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def solve(n):
	if n % 2 == 0:
		return n // 2 - 1
	return n // 2

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		ans = solve(n)
		sys.stdout.write(str(ans) + '\n')
main()


n = int(input())
for i in range(0, n):
	o = int(input())
	if o <= 2:
		print(0)
	else:
		A = o // 2
		if o % 2 == 0:
			print(A - 1)
		else:
			print(A)


import math
t = int(input())
for i in range(t):
	l = int(input())
	print(math.ceil(l / 2) - 1)


testcases = int(input())
for case in range(testcases):
	n = int(input())
	if n in [0, 1]:
		print(0)
	else:
		print((n - 1) // 2)


import sys
s = int(sys.stdin.readline().split()[0])
t = []
for l in sys.stdin:
	for w in l.split():
		t.append(int(w))
for test in t:
	if test % 2 == 0:
		print(int(test / 2) - 1)
	else:
		print(int(test / 2))


def main_function():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n < 3:
			print(0)
		else:
			print(n // 2 - 1 if n % 2 == 0 else n // 2)
main_function()


n = int(input())
L = []
for i in range(n):
	L.append(int(input()))
for i in L:
	if i <= 2:
		print(0)
	elif i % 2 == 1:
		print(i // 2)
	elif i % 2 == 0:
		print(i // 2 - 1)


n = int(input())
c = 0
for i in range(n):
	l = int(input())
	if l == 1 or l == 2:
		print(0)
	elif l % 2 == 1:
		print(l // 2)
	else:
		print(l // 2 - 1)


def candy(n):
	if n % 2 == 0:
		return (n - 2) // 2
	elif n % 2 != 0:
		return (n - 1) // 2
t = int(input())
for i in range(t):
	a = int(input())
	ans = candy(a)
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	mid = int(n / 2)
	print(n - 1 - mid)
	t -= 1


t = int(input())
for i in range(t):
	total = int(input())
	print(total // 2 - (1 - total % 2))


t = int(input())
for _ in range(t):
	n = int(input())
	print(len(range(n // 2 + 1, n)))


from itertools import permutations
import math
test_case = int(input())
for _ in range(test_case):
	n = int(input())
	print(math.ceil(n / 2) - 1)


n = int(input())
a = []
for i in range(n):
	a.append((int(input()) - 1) // 2)
for item in a:
	print(item)


cases = int(input())
while cases > 0:
	a = int(input())
	print(int((a - 1) / 2))
	cases -= 1


for i in range(int(input())):
	k = int(input())
	if k & 1 == 1:
		print(k // 2)
	else:
		print(k // 2 - 1)


import math
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	temp = n // 2 + 1
	print(n - temp)


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

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

def main():
	t = inin()
	while t > 0:
		n = inin()
		if n == 1 or n == 2:
			print('0')
		elif n % 2 != 0:
			print(int((n - 1) / 2))
		else:
			print(int(n / 2 - 1))
		t = t - 1
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


t = int(input())
for loop in range(t):
	n = int(input())
	print((n - 1) // 2)


t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	c = n - 1 - k
	print(c)


t = int(input())
while t > 0:
	t -= 1
	s = int(input())
	if s % 2 == 0:
		print(int(s / 2) - 1)
	else:
		print(int(s / 2))


T = int(input())
for i in range(T):
	N = int(input())
	if N < 3:
		print(0)
	elif N % 2:
		print(N // 2)
	else:
		print(N // 2 - 1)


T = int(input())
for i in range(T):
	t = int(input()) - 1
	print(t // 2)


from sys import stdin as inp
from sys import stdout as out
from sys import maxsize as max
t = int(inp.readline().strip())
for i in range(t):
	n = int(inp.readline().strip())
	if n & 1:
		out.write(str(n // 2))
	else:
		out.write(str(n // 2 - 1))
	out.write('\n')


from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
while t > 0:
	n = int(input())
	print((n - 1) // 2)
	t -= 1


import math
t = int(input())
for _ in range(t):
	n = int(input())
	result = math.floor((n - 1) / 2)
	print(int(result))


def solve():
	n = int(input())
	ans = None
	if n <= 2:
		ans = 0
	elif n % 2 != 0:
		ans = n // 2
	else:
		ans = n // 2 - 1
	print(ans)
t = int(input())
while t > 0:
	solve()
	t -= 1


T = int(input())
for _ in range(0, T):
	n = int(input())
	x = 0
	a = 0
	if n > 2:
		x = 1
		if n % 2 == 0:
			a = n // 2 - 1
		else:
			a = n // 2
	if x == 1:
		print(a)
	else:
		print(0)


t = int(input())
for i in range(t):
	cp = int(input())
	if cp <= 2:
		print(0)
		continue
	else:
		ans = 0
		if cp % 2 == 0:
			ans = cp // 2 - 1
		else:
			ans = cp // 2
		print(ans)


for i in range(1, int(input()) + 1):
	print(int(int(input()) / 2 - 0.5))


t = int(input())
r = []
for oo in range(t):
	n = int(input())
	r.append(n - n // 2 - 1)
for i in r:
	print(i)


from functools import reduce
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		n = Read.int()
		if n <= 2:
			print(0)
		elif n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
main()


kl = int(input())
for l in range(kl):
	n = int(input())
	print((n - 1) // 2)


t = int(input())
for i in range(1, t + 1):
	a = int(input())
	if a == 1:
		print(0)
	elif a % 2 != 0:
		value = a // 2
		print(value)
	else:
		value = a // 2
		d = value - 1
		print(d)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 2:
			print(n // 2)
		else:
			print(n // 2 - 1)
main()


import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
try:
	for _ in range(int(input())):
		n = int(input())
		if n == 1:
			print(0)
		else:
			print(int(ncr(n, 2) // n))
except:
	pass


from sys import stdin, stdout
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	T = int(rl())
	for _ in range(T):
		n = int(rl())
		div = n // 2
		if n % 2 == 0:
			stdout.write(str(div - 1))
			stdout.write('\n')
		else:
			stdout.write(str(div))
			stdout.write('\n')
	stdout.close()
main()


def distribution(c):
	half = c // 2 + 1
	print(c - half)
tests = int(input())
for i in range(tests):
	candy = int(input())
	result = distribution(candy)


T = int(input())
for i in range(T):
	N = int(input())
	print((N - 1) // 2)


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2:
		print('0\n')
	elif n % 2 == 0:
		print(str(n // 2 - 1))
		print('\n')
	else:
		print(str(n // 2))
		print('\n')


Count = int(input())
inp_data = []
while Count != 0:
	inp_data.append(int(input()))
	Count = Count - 1
for temp in inp_data:
	if temp % 2 == 0:
		print(int(temp / 2 - 1))
	else:
		print(int(temp / 2 - 0.5))


t = int(input())
for xy in range(t):
	k = int(input())
	print((k + 1) // 2 - 1)


from sys import stdin
n = int(input())
for _ in range(n):
	k = int(input())
	if k in (1, 2):
		print(0)
	elif k % 2 == 1:
		print(int(k // 2))
	else:
		print(int(k // 2 - 1))


t = int(input())
moves = []
count = 0
rem = 0
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(int(n / 2 - 1))
	else:
		print(int((n - 1) / 2))


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for t in range(int(input())):
	print((int(input()) - 1) // 2)


test = int(input(''))
n_way = []
while test > 0:
	candy = int(input(''))
	way = int((candy - 1) / 2)
	n_way.append(way)
	test -= 1
for n in n_way:
	print(n)


for f in range(int(input())):
	n = int(input())
	print(max((n - 1) // 2, 0))


T = int(input())
for t in range(T):
	n = int(input())
	ans = n // 2
	if n % 2 == 0:
		ans -= 1
	print(max(0, ans))


t = int(input())
for k in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
		continue
	if n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	print((n - 1) // 2)
for _ in range(int(input())):
	main()


import math

def check(n):
	if n <= 2:
		return 0
	elif n % 2 != 0:
		return n // 2
	else:
		return n // 2 - 1
t = int(input())
for i in range(0, t, 1):
	n = int(input())
	print(check(n))


import math
print('\n'.join([str(max(math.ceil(int(input()) / 2) - 1, 0)) for c in range(int(input()))]))


def program():
	n = int(input())
	if n % 2 == 0:
		ans = n // 2 - 1
	else:
		ans = n // 2
	print(ans)
t = int(input())
for i in range(t):
	program()


n = int(input())

def find(candy):
	if candy <= 2:
		return 0
	elif candy % 2 == 0:
		return candy // 2 - 1
	else:
		return candy // 2
output = []
for i in range(n):
	candy = int(input())
	output.append(find(candy))
for i in output:
	print(i)


test_cases = int(input())
for i in range(test_cases):
	no_of_candies = int(input())
	if no_of_candies == 1 or no_of_candies == 2:
		print(0)
	elif no_of_candies % 2 == 0:
		print(int(no_of_candies / 2) - 1)
	else:
		print(int(no_of_candies // 2))


import math
N = int(input())
for i in range(0, N):
	T = int(input())
	print(math.floor((T - 1) / 2))


from math import gcd
from collections import Counter

def printYes():
	print('YES')

def printNo():
	print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


import math
t = int(input())
l = []
for i in range(t):
	l.append(int(input()))
for k in range(len(l)):
	if l[k] % 2 == 0:
		print(int(l[k] / 2 - 1))
	else:
		print(int(math.trunc(l[k] / 2)))


tc = int(input())
import math
for _ in range(tc):
	num = int(input())
	k = math.ceil(num / 2)
	print(k - 1)


def ways(n):
	if n == 1 or n == 2:
		return 0
	if n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2
t = int(input())
while t:
	n = int(input())
	print(ways(n))
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	temp = int(n / 2 - 0.5)
	if temp < 0:
		print(0)
	else:
		print(temp)


t = eval(input())
while t:
	n = eval(input())
	print((n - 1) // 2)
	t -= 1


from sys import stdin
N = int(stdin.readline())
for case in range(N):
	x = int(stdin.readline())
	print((x - 1) // 2)


def distribute(number):
	n = int(input())
	if n % 2 == 0:
		ways = n // 2 - 1
	else:
		ways = n // 2
	return ways

def solve(iteration):
	result = distribute(iteration)
	print(result)
t = int(input())
for i in range(t):
	solve(i)


tests = int(input())
mass = [0] * tests
for i in range(tests):
	mass[i] = int(input())
for i in range(tests):
	if mass[i] % 2 == 1:
		mass[i] = mass[i] // 2
	else:
		mass[i] = mass[i] // 2 - 1
	print(mass[i])


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


def RA():
	l = input().split()
	return [int(s) for s in l]

def solve():
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
t = int(input())
for i in range(t):
	solve()


import math

def f(n):
	if (math.log(n) / math.log(2)).is_integer() == True:
		return True
	else:
		return False
t = int(input())
for i in range(t):
	n = int(input())
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


n = int(input())
test_cases = [int(input()) for _ in range(n)]
answer = []
for i in test_cases:
	if i % 2 == 0:
		answer.append(int(i / 2 - 1))
	else:
		answer.append(i // 2)
for i in answer:
	print(i)


t = int(input())
while t > 0:
	n = int(input())
	sum = n - (int(n / 2) + 1)
	print(sum)
	t -= 1


import sys
inputs = []
for line in sys.stdin.readlines():
	inputs.append(line.strip())
t = int(inputs[0])
for i in range(t):
	n = int(inputs[i + 1])
	half_start = n // 2 + 1
	if half_start >= n:
		print(0)
	else:
		print(n - half_start)


import math
for w in range(int(input())):
	n = int(input())
	if n <= 2:
		print(0)
	elif n % 2 == 0:
		print(int(n / 2 - 1))
	else:
		print(math.floor(n / 2))


from math import floor
for loop in range(int(input())):
	n = int(input())
	bb = (n - 1) / 2
	print(floor(bb))


from sys import stdin, stdout
from math import gcd, sqrt, floor, ceil
input = stdin.readline

def list_inp(x):
	return list(map(x, input().split()))

def map_inp(x):
	return map(x, input().split())

def lcm(a, b):
	return a * b / gcd(a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


cases = int(input())

def ways(n):
	count = n - int(n / 2 + 1)
	return count
for i in range(cases):
	n = int(input())
	print(ways(n))


import sys
input = sys.stdin.readline
t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	n -= 2
	ans.append((n + 1) // 2)
for i in ans:
	print(i)


import math

def solutions(c):
	if c > 2:
		return math.floor((c - 1) / 2)
	else:
		return 0
n = int(input())
for _ in range(n):
	c = int(input())
	print(solutions(c))


def solve(i):
	if i % 2 == 0:
		print(i // 2 - 1)
	else:
		print(i // 2)

def main():
	t = int(input())
	for _ in range(t):
		i = int(input())
		solve(i)
main()


def f(n):
	if n < 3:
		return 0
	return n // 2 if n % 2 else n // 2 - 1

def main():
	t = int(input())
	for _ in range(t):
		print(f(int(input())))
main()


t = int(input())
lst = list()
for i in range(t):
	n = int(input())
	lst.append(n)
for j in lst:
	ways = j - (int(j / 2) + 1)
	print(ways)


import math
import random
import re
import itertools

def probA(s):
	a = []
	for j in range(len(s)):
		if s[j] % 2 == 0:
			a.append(s[j] // 2 - 1)
		else:
			a.append(s[j] // 2)
	return a
t = int(input().strip())
lis = []
for i in range(t):
	lis.append(int(input().strip()))
result = probA(lis)
for k in result:
	print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3:
		print(0)
		continue
	a = 0
	b = 0
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


from math import ceil
t = int(input())
for i in range(t):
	n = int(input())
	lower = ceil((n + 1) / 2)
	upper = n - 1
	count = upper - lower + 1
	if count > 0:
		print(count)
	else:
		print(0)


for ii in range(int(input())):
	n = int(input())
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


n = int(input())
e = []
for i in range(n):
	x = int(input())
	if x % 2 == 1:
		e.append(x // 2)
	else:
		e.append(x // 2 - 1)
for i in e:
	print(i)


def solve():
	n = int(input())
	if n <= 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
try:
	for _ in range(int(input())):
		solve()
except:
	pass


import sys
import math
readLine = lambda : sys.stdin.readline()
readInt = lambda : int(sys.stdin.readline())
readInts = lambda : [int(x) for x in sys.stdin.readline().split(' ')]

def main():
	solns = []
	t = readInt()
	for _ in range(t):
		n = readInt()
		if n % 2 == 0:
			a = n // 2 + 1
			b = n // 2 - 1
		else:
			b = n // 2
			a = n // 2 + 1
		solns.append(str(n - a))
	print('\n'.join(solns))
main()


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


from math import ceil
amount = int(input())
for _ in range(amount):
	num = int(input())
	print(ceil(num / 2) - 1)


T = int(input())
for case in range(T):
	n = int(input())
	print(n - n // 2 - 1)


tc = 0
try:
	tc = int(input())
except:
	pass
for ii in range(tc):
	n = int(input())
	if n % 2 == 0:
		ans = (n - 2) // 2
	else:
		ans = (n - 1) // 2
	print(ans)


from math import *
t = int(input())
a = []
for i in range(t):
	a.append(int(input()))

def chk(k):
	if k == 1 or k == 2:
		return 0
	elif k % 2 == 1:
		return k - ceil(k / 2)
	else:
		return int(k - k / 2 - 1)
for i in a:
	print(chk(i))


from collections import *
from bisect import *
from math import ceil, factorial, gcd
from heapq import *
mod = 10 ** 9 + 7
AZ = dict(zip('ABCDEFGHIJKLMNOPQRSTUVWXYZ', range(1, 27)))

def bs(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return True
	else:
		return False

def prime_sieve(n):
	prime = [1] * (n + 1)
	prime[0] = prime[1] = 0
	for i in range(2, n + 1):
		for j in range(i * i, n + 1, i):
			prime[j] = 0
	return prime
prime = prime_sieve(1000001)
from sys import stdin
testcase = True
if testcase:
	t = int(stdin.readline())
	while t:
		t -= 1
		n = int(stdin.readline())
		if n & 1:
			ans = n // 2
		else:
			ans = (n - 2) // 2
		print(ans)
else:
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))


def choco(n):
	if n % 2 == 0:
		a = n // 2 - 1
	else:
		a = n // 2
	return a
n = int(input())
for i in range(n):
	a = int(input())
	x = choco(a)
	print(x)
5 // 2


def r(t=int):
	return list(map(t, input().split()))

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for _ in range(r()[0]):
	n = r()[0]
	print(max((n + 1) // 2 - 1, 0))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		n -= 1
	an = n // 2
	print(an)


def f(n):
	if n <= 2:
		return 0
	if n % 2 == 0:
		return (n - 1) // 2
	return n // 2
T = int(input())
for t in range(T):
	n = int(input())
	print(f(n))


def func(n):
	for i in range(n):
		k = int(input())
		if k % 2 == 0:
			print(k // 2 - 1)
		else:
			print(k // 2)
n = int(input())
func(n)


t = int(input())

def fun(n):
	if n % 2 == 0:
		print(int(n / 2) - 1)
	else:
		print(int((n - 1) / 2))
while t:
	t -= 1
	n = int(input())
	fun(n)


from sys import stdin

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		n = int(inp())
		print((n - 1) // 2)
main()


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	z = int(n / 2)
	if n == 1 or n == 2:
		print('0')
		continue
	if n % 2 == 0:
		print(n - (z + 1))
	else:
		print(n - (z + 1))


T = int(input())
for t in range(T):
	x = int(input())
	a = x // 2 + x % 2
	b = x // 2
	if not x % 2:
		a += 1
		b -= 1
	print(b)


import sys
input = sys.stdin.readline
from collections import *
from math import *
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n <= 2:
		print(0)
	else:
		r = n // 2
		if n % 2:
			pass
		else:
			r -= 1
		print(r)


t = int(input())
for w in range(t):
	n = int(input())
	d = n // 2 + 1
	e = n - 1
	print(e - d + 1)


n = int(input())
for i in range(n):
	temp = int(input())
	print(temp - temp // 2 - 1)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	if N % 2 == 0:
		print(N // 2 - 1)
	else:
		print(N // 2)

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


T = int(input())
out = []
for i in range(T):
	n = int(input())
	if n <= 0:
		out.append(0)
	elif n % 2 == 0:
		out.append(n // 2 - 1)
	elif n % 2 != 0:
		out.append(n // 2)
for i in range(T):
	print(out[i])


t = int(input())
for ii in range(t):
	b = int(input())
	if b % 2 == 0:
		print(b // 2 - 1)
	else:
		print(b // 2)


def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
for i in range(n):
	z = inp()
	z -= 1
	print(z // 2)


def solution():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n == 1:
			print(0)
			continue
		print(n // 2 - 1 + n % 2)
import sys
import threading
sys.setrecursionlimit(1 << 30)
threading.stack_size(1 << 27)
thread = threading.Thread(target=solution)
thread.start()
thread.join()


def main():
	answers = []
	for i in range(int(input())):
		answers.append((int(input()) - 1) // 2)
	print(*answers, sep='\n')
main()


a = int(input())
for i in range(a):
	x = int(input())
	t = x - 1
	k = x // 2 + 1
	print(t - k + 1)


import sys
count = int(input())
for _ in range(count):
	n = int(input())
	x = n // 2
	print(x if n % 2 else x - 1)


x = int(input())
c = []
t = 0
for i in range(x):
	c.append(int(input()))
for i in range(x):
	if c[i] % 2 == 0:
		print(c[i] // 2 - 1)
	else:
		print(c[i] // 2)


t = int(input())
for case in range(t):
	n = int(input())
	print((n - 1) // 2)


import math as m
t = int(input())
for i in range(t):
	ans = 0
	n = int(input())
	ans = m.ceil(n / 2 - 1)
	print(ans)


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


x = int(input())
lyst = []
for i in range(x):
	y = int(input())
	lyst.append(y)
for j in lyst:
	if j <= 2:
		print(0)
	elif j % 2 == 0:
		print(int((j - 1) / 2))
	else:
		print(int(j / 2))


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
		continue
	tmp = n // 2
	tmp_1 = n - tmp
	if tmp == tmp_1:
		print(tmp - 1)
	else:
		print(tmp)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import time, random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

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 pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	na = [I() for _ in range(t)]
	rr = []
	for n in na:
		k = (n - 1) // 2
		if k < 1:
			rr.append(0)
		else:
			rr.append(k)
	return JA(rr, '\n')
print(main())


import math

def Cases(num):
	if num % 2 == 0:
		num = num - 1
	print(math.floor(num / 2))
case = int(input())
for i in range(case):
	number = int(input())
	Cases(number)


import math
import string
a = int(input())
for i in range(a):
	b = int(input())
	if b % 2 == 0:
		print(int(b / 2) - 1)
	elif b == 1:
		print(0)
	else:
		b = b - 1
		b = int(b / 2)
		print(int(b))


def compute(n):
	return n - (n // 2 + 1)
t = int(input())
for _ in range(t):
	n = int(input())
	print(compute(n))


for case in range(int(input())):
	n = int(input())
	n += 1
	ways = 0
	na = n - 1
	nb = 1
	if n > 3:
		ways = int(n / 2)
		print(ways - 1)
	else:
		print(0)


test = int(input())
while test != 0:
	n = int(input())
	if n < 3:
		print(0)
	elif n & 1:
		n -= 1
		print(n // 2)
	else:
		n = n // 2
		print(n - 1)
	test -= 1


import math
for _ in range(int(input())):
	n = int(input())
	res = math.floor(n / 2)
	if n % 2 == 0:
		print(res - 1)
	else:
		print(res)


hm = int(input())
for i in range(hm):
	n = int(input())
	print((n - 1) // 2)


cases = int(input())
while cases != 0:
	candies = int(input())
	ways = candies // 2
	if candies % 2 == 0:
		ways = ways - 1
	print(ways)
	cases = cases - 1


t = int(input())
respostas = []
for x in range(t):
	n = int(input())
	respostas.append((n - 1) // 2)
for x in respostas:
	print(x)


import collections, heapq, itertools, math, functools
groupby = itertools.groupby
rs = lambda : input()
ri = lambda : int(input())
rm = lambda : map(int, input().split())
rai = lambda : [int(x) for x in input().split()]

def solve():
	if n % 2 == 0:
		return n // 2 - 1
	else:
		return n // 2
for t in range(ri()):
	n = ri()
	print(solve())


import math
import sys
from collections import defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]
INF = 10 ** 18
MOD = 1000000000 + 7
for _ in range(int(input())):
	N = int(input())
	if N <= 2:
		print(0)
	else:
		x = N // 2
		print(N - x - 1)


t = int(input())
for q in range(t):
	print((int(input()) - 1) // 2)


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


import sys
input = lambda : sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline

def I():
	return list(map(int, inp().split()))
for _ in range(I()[0]):
	(n,) = I()
	print(n // 2 - (n % 2 == 0))


def main():
	n = int(input())
	for _ in range(n):
		inp = int(input())
		if inp < 3:
			print(0)
		elif inp % 2 == 0:
			print(inp // 2 - 1)
		else:
			print(inp // 2)
main()


z = input
for _ in range(int(z())):
	x = int(z())
	if x <= 2:
		print(0)
		continue
	if x <= 4:
		print(1)
		continue
	if x <= 6:
		print(2)
		continue
	s = x // 2
	c = s + 1
	print(abs(x - c))


import sys
input = sys.stdin.readline
for t in range(int(input())):
	n = int(input())
	if n < 2:
		print(0)
	elif n % 2 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


t = int(input())
arr = []
while t > 0 and t < 10 ** 4 + 1:
	n = int(input())
	if n in range(1, 2 * 10 ** 9 + 1):
		arr.append(n)
	t -= 1
l = len(arr)
for i in range(0, l):
	x = arr[i] // 2
	a = arr[i] - x
	if a > 0 and x > 0 and (a > x):
		print(x)
	elif a == x:
		x -= 1
		print(x)
	else:
		print(0)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

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))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(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
from functools import reduce

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)))

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

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def solve():
	n = N()
	print((n - 1) // 2)
testcase(int(inp()))


from math import *
a = int(input())
for i in range(a):
	b = int(input())
	print(b - floor(b / 2) - 1)


(t, *x) = map(int, open(0).read().split())
ans = [(y - 1) // 2 for y in x]
print('\n'.join(map(str, ans)))


t = int(input())
ans = [0] * t
for i in range(t):
	a = int(input())
	if 1 & a:
		ans[i] += a // 2
	else:
		ans[i] = a // 2 - 1
print(*ans, sep='\n')


t = int(input())
list = []
for i in range(t):
	candies = int(input())
	if candies == 1 or candies == 2:
		list.append('0')
	elif candies % 2 != 0:
		list.append(candies // 2)
	else:
		list.append(candies // 2 - 1)
print(*list, sep='\n')


t = int(input())
for x in range(t):
	candles = int(input())
	if candles % 2 == 0:
		print(candles // 2 - 1)
	elif candles % 2 == 1:
		print(candles // 2)


def cal(N):
	return (N - 1) // 2

def web():
	T = int(input())
	for t in range(1, T + 1):
		arr = [int(s) for s in input().split(' ')]
		N = arr[0]
		ans = cal(N)
		print(str(ans))

def file():
	x = open('p1_in.txt')
	T = int(x.readline())
	for t in range(1, T + 1):
		arr = [int(s) for s in x.readline().split(' ')]
		N = arr[0]
		ans = cal(N)
		print(str(ans))
web()


t = int(input())
for g in range(t):
	n = int(input())
	cnt = n // 2 + 1
	print(n - cnt)


a = int(input())
for i in range(a):
	b = int(input())
	if b == 1 or b == 2:
		print(0)
		continue
	if b % 2 > 0:
		print(int(b / 2))
	elif b % 2 == 0:
		print(int(b / 2 - 1))


t = [int(i) for i in input().split(' ')][0]
odpoved = []
for _ in range(t):
	n = [int(i) for i in input().split(' ')][0]
	res = n // 2
	if n % 2 == 0:
		res -= 1
	odpoved.append(res)
print(*odpoved, sep='\n')


t = int(input())
arr = []
for i in range(t):
	n = int(input())
	arr.append(n)
for ele in arr:
	if ele % 2 == 1:
		print((ele - 1) // 2)
	else:
		print((ele - 2) // 2)


Test = int(input())
while Test:
	num = int(input())
	if num % 2 == 0:
		print(num // 2 - 1)
	else:
		print(num // 2)
	Test -= 1


import sys
t = int(sys.stdin.readline())
ans_arr = []
for i in range(t):
	n = int(sys.stdin.readline())
	if n % 2 == 0:
		ans_arr.append(str(n // 2 - 1))
	else:
		ans_arr.append(str(n // 2))
print('\n'.join(ans_arr))


t = int(input())
for rep in range(t):
	n = int(input())
	print((n - 1) // 2)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		if N % 2 == 0:
			print(N // 2 - 1)
		else:
			print(N // 2)
main()


n = int(input())
for i in range(0, n):
	d = int(input())
	if d == 1 or d == 2:
		print(0)
	if d >= 3 and d % 2 == 0:
		print(int((d - 2) / 2))
	if d >= 3 and d % 2 != 0:
		print(int((d - 1) / 2))


test = int(input())
sol = []
while test:
	test -= 1
	n = int(input())
	if n <= 2:
		sol.append(0)
	elif n % 2 == 0:
		sol.append(n // 2 - 1)
	else:
		sol.append(n // 2)
for i in sol:
	print(i)


T = int(input())
t = 0
while t < T:
	n = int(input())
	if n % 2 == 0:
		modi = n // 2 - 1
	else:
		modi = n // 2
	t += 1
	print(modi)


length = input()
for x in range(int(length)):
	num = int(input())
	if num < 3:
		print(0)
	elif num % 2 != 0:
		print(int(num / 2))
	else:
		print(int(num / 2) - 1)


def calc(num):
	if num % 2:
		return (num - 1) // 2
	return num // 2 - 1
t = int(input())
for i in range(1, t + 1):
	nl = int(input())
	result = calc(nl)
	print(result)


t = int(input())
for test in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	count = 0
	if n % 2 == 0:
		a = n // 2 + 1
		b = n - a
		print(n - a)
	else:
		a = n // 2 + 1
		b = n - a
		print(n - a)


for _ in range(int(input())):
	num_cand = int(input())
	if num_cand % 2 == 0:
		num_ways = (num_cand - 2) // 2
	else:
		num_ways = (num_cand - 1) // 2
	print(num_ways)


t = int(input())
import math
delay = []
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


for _ in range(int(input())):
	inp = int(input())
	print((inp - 1) // 2)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

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

def in_str():
	s = input()
	return list(s[:len(s) - 1])

def in_ints():
	return map(int, input().split())
t = in_int()
for tt in range(t):
	n = in_int()
	print((n - 1) // 2)


import math
s = int(input())
for i in range(s):
	n = float(input())
	if n <= 2:
		print(0)
	else:
		y = math.ceil(n / 2)
		k = y - 1
		print(k)


import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
	n = int(input())
	print((-1 + n) // 2)


T = int(input())
for i in range(0, T):
	a = int(input())
	if a % 2 != 0:
		r = a / 2
	elif a % 2 == 0:
		r = a / 2
		r = r - 1
	elif a == 0 or a == 1 or a == 2:
		r = 0
	print(int(r))


for _ in range(int(input())):
	z = int(input())
	if z <= 2:
		print(0)
	elif z % 2 != 0:
		print(z // 2)
	else:
		print(z // 2 - 1)


print(*((int(input()) - 1) // 2 for t in range(int(input()))), sep='\n')


TC = int(input())
while TC > 0:
	n = int(input())
	print((n - 1) // 2)
	TC -= 1


import sys
data = list(map(int, sys.stdin.read().split()))
n = data[0]
arr = data[1:]
for i in range(len(arr)):
	print((arr[i] - 1) // 2)


import sys
import math

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	m = n - 1
	ans = m // 2
	print(ans)


import sys
input = sys.stdin.readline

def inp():
	return int(input())
T = inp()
for i in range(T):
	n = inp()
	if n < 3:
		print(0)
	elif n % 2 == 1:
		print((n - 1) // 2)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print('ERROR')


T = int(input())
for x in range(T):
	n = int(input())
	h = n // 2
	if n % 2 == 0:
		print(h - 1)
	else:
		print(h)


try:
	for i in range(int(input())):
		n = int(input())
		if n == 1:
			print(0)
			continue
		if n == 2:
			print(0)
			continue
		if n % 2 == 0:
			print(int(n - (n / 2 + 1)))
		else:
			print(n // 2)
except:
	pass


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

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

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		n = II()
		print((n - 1) // 2)
main()


inp = int(input())
for i in range(inp):
	inp1 = int(input())
	y = int(inp1 / 2) + 1
	print(inp1 - y)


import sys

def main():
	n = int(sys.stdin.readline())
	for i in range(n):
		x = int(sys.stdin.readline())
		if x == 2:
			y = 0
		elif x % 2 != 0:
			y = x // 2
		else:
			y = x // 2 - 1
		sys.stdout.write(str(y))
		sys.stdout.write('\n')
main()


t = int(input())
answers = []
for i in range(t):
	candies = int(input())
	if candies / 2 <= 1:
		answers.append(0)
	elif candies % 2 == 1:
		answers.append(candies // 2)
	else:
		answers.append(candies // 2 - 1)
for i in answers:
	print(i)


from collections import deque
import math
for i in range(int(input())):
	n = int(input())
	answer = n // 2 - (0 if n % 2 != 0 else 1)
	print(answer)


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


t = int(input())
for x in range(t):
	n = int(input())
	if n <= 2:
		print('0')
		continue
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


import math
t = int(input())
for i in range(t):
	loc = int(input())
	ans = math.trunc(loc / 2)
	if loc % 2 == 0:
		ans -= 1
	print(ans)


t = int(input())
while t:
	n = int(input())
	c = n // 2 + 1
	c = n - c
	if n < 3:
		print('0')
	else:
		print(c)
	t -= 1


n = int(input())
while n > 0:
	x = int(input())
	print(x - x // 2 - 1)
	n -= 1


for _ in range(int(input())):
	num = int(input())
	if num <= 2:
		print(0)
	else:
		i = 0
		temp_num = num // 2
		if num % 2 == 0:
			print(temp_num - 1)
		else:
			print(temp_num)


import sys
import math
msg = sys.stdin.read()
l = list(map(int, msg.split()))
l = l[1:]
for i in l:
	n = i / 2
	if n % 1 == 0:
		ans = n - 1
	else:
		ans = math.floor(n)
	print(int(ans))


tests = int(input())
while tests > 0:
	tests -= 1
	n = int(input())
	print(int((n - 1) / 2))


case = int(input())
for i in range(case):
	x = int(input())
	print((x - 1) // 2)


import math
test = int(input())
while test:
	number = int(input())
	if number < 3:
		print(0)
	elif number % 2 == 0:
		print(int(number / 2 - 1))
	else:
		print(int(number / 2))
	test -= 1


import sys
for i in range(int(sys.stdin.readline())):
	a = int(sys.stdin.readline())
	if a == 1 or a == 2:
		sys.stdout.write('{}\n'.format(0))
		continue
	if a % 2 == 0:
		sys.stdout.write('{}\n'.format(a // 2 - 1))
		continue
	sys.stdout.write('{}\n'.format(a // 2))


for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
		continue
	print(n - int(n / 2) - 1)


import math
m = int(input())
for i in range(m):
	n = int(input())
	n = n - 2
	print(math.ceil(n / 2))


from sys import stdin, stdout

def candy():
	n = int(stdin.readline())
	if n % 2 == 0:
		res = n // 2 - 1
	else:
		res = n // 2
	stdout.write(str(res) + '\n')
t = int(input())
for loop in range(t):
	candy()


import sys
t = int(input())

def distributions(candies):
	a = candies - 1
	b = candies - a
	if not a > b:
		return 0
	possible = (candies - 1) // 2
	return possible
for i in range(t):
	n = int(input())
	print(distributions(n))


import sys

def solve(n):
	ans = (n - 1) // 2
	print(ans)
count = 0
n_tests = 0
for line in sys.stdin:
	if n_tests == 0:
		n_tests = int(line)
	else:
		count += 1
		solve(int(line))
		if count == n_tests:
			break


for _ in range(int(input())):
	n = int(input())
	a = n // 2
	des = n - a
	print(des - 1)


import sys

def main():
	t = int(input())
	for _ in range(t):
		n = int(sys.stdin.readline().strip())
		if n <= 2:
			print(0)
		else:
			print((n - 1) // 2)
	return
main()


def answer():
	n = int(input())
	c = []
	while n:
		b = int(input())
		c.append(b)
		n -= 1
	for x in c:
		if x < 3:
			print(0)
		elif x % 2:
			print(int(x / 2))
		else:
			print(int(x / 2) - 1)
answer()


n = int(input())

def func(x):
	if x == 0 or x == 1 or x == 2:
		print(0)
	elif x % 2 == 0:
		print(int(x / 2) - 1)
	elif x % 2 != 0:
		print(int((x + 1) / 2) - 1)
for i in range(0, n):
	y = int(input())
	func(y)


exec(int(input()) * 'print((int(input())-1)//2);')


t = int(input())
results = []
for i in range(t):
	n = int(input())
	results.append((n - 1) // 2)
for i in results:
	print(i)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = n - 1
	c = a // 2
	print(c)


import sys
from math import sqrt, floor, ceil
from collections import deque, Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		res = abs(n - 1 - ceil(n / 2) + n % 2)
		ans += str(res) + '\n'
	print(ans)
a()


import sys
input = sys.stdin.readline
Q = int(input())
Query = [int(input()) for _ in range(Q)]
for N in Query:
	N -= 2
	print(max((N + 1) // 2, 0))


def candy(n):
	if n % 2 == 0:
		w = n // 2 - 1
		return w
	else:
		w = n // 2
		return w
t = int(input())
while t > 0:
	i = int(input())
	print(candy(i))
	t -= 1


from sys import stdin
from sys import stdout
sprint = stdout.write
sinput = stdin.readline

def func():
	n = int(input())
	a = n // 2
	a -= 1 if n % 2 == 0 else 0
	print(a)
t = int(sinput())
while t != 0:
	t -= 1
	func()


for _ in range(int(input())):
	ans = int(input())
	print(str(ans // 2 if ans % 2 != 0 else ans // 2 - 1))


t = int(input())
for ig in range(t):
	n = int(input())
	if n <= 2:
		print(0)
	elif n & 1 == 1:
		print(n // 2)
	else:
		print(n // 2 - 1)


def sol(n):
	if n % 2 == 0:
		a = n / 2 - 1
	else:
		a = n // 2
	print(int(a))
T = int(input())
for _ in range(T):
	n = int(input())
	sol(n)


import math
n = int(input())
while n:
	n -= 1
	a = int(input())
	if a <= 0:
		print(0)
	else:
		a = a - 1
		print(math.floor(a / 2))


from math import floor
t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		ans.append(n // 2 - 1)
	else:
		ans.append(n // 2)
print(*ans, sep='\n')


import math
t = int(input())
candies = []
res = []
for x in range(t):
	count = 0
	candies.append(int(input()))
	res.append(math.ceil(candies[x] / 2) - 1)
for x in range(t):
	print(res[x])


import sys

def solve(num, l):
	for v in l:
		if v % 2 == 0:
			print(v // 2 - 1)
		else:
			print(v // 2)
inputFile = sys.stdin.readlines()
for i in range(0, len(inputFile)):
	inputFile[i] = inputFile[i].rstrip()
num = int(inputFile[0])
inputFile = list(map(int, inputFile[1:]))
solve(num, inputFile)


from math import floor
T = int(input())
for test in range(T):
	N = int(input())
	print(floor((N - 1) / 2))


def testcase(n):
	print((n + 1) // 2 - 1)
n = int(input())
for _ in range(n):
	i = int(input())
	testcase(i)


def candy(candies):
	if candies < 3:
		return 0
	return int((candies - 1) / 2)
cases = int(input())
while cases > 0:
	candies = int(input())
	print(candy(candies))
	cases -= 1


n = int(input())
b = list()
for i in range(0, n):
	a = int(input())
	if a < 3:
		b.append(0)
		continue
	if a % 2 == 0:
		b.append(a // 2 - 1)
	else:
		b.append(a // 2)
for i in range(0, len(b)):
	print(b[i])


t = int(input())
l = []
for i in range(t):
	num = int(input())
	l.append(num)
for n in l:
	m = int(n / 2)
	if n % 2 == 0:
		print(m - 1)
	else:
		print(m)


def solve(n):
	if n % 2 == 0 and n != 2:
		print(n // 2 - 1)
	elif n == 2 or n == 1:
		print('0')
	else:
		print((n + 1) // 2 - 1)
for i in range(int(input())):
	n = int(input())
	solve(n)


import math
t = int(input())
l = []
while t:
	l.append(int(input()))
	t -= 1
a = 0
for i in l:
	print(math.ceil(i / 2) - 1)


hm = int(input())
for _ in range(hm):
	cand = int(input())
	vaag = cand / 2 % 1
	if vaag == 0:
		print(int(cand / 2) - 1)
	else:
		print(int(cand / 2))


for i in range(int(input())):
	a = int(input())
	k = a // 2
	if a == 1 or a == 2:
		print(0)
	elif a % 2 != 0:
		print(k)
	elif a % 2 == 0:
		print(k - 1)


test = int(input())
c = 0
for i in range(test):
	m = int(input())
	if m % 2 == 0:
		n = m / 2 + 1
	else:
		n = (m + 1) / 2
	b = m - n
	print(int(b))


from pprint import pprint
import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	n = int(input())
	if n < 3:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print((n - 1) // 2)


test_cases = int(input())
list = []
answer = 0
x = 0
answer_list = []
y = 0
for n in range(test_cases):
	c_input = int(input())
	list.append(c_input)
for n in range(len(list)):
	answer = int((list[x] - 1) / 2)
	answer_list.append(answer)
	x += 1
for n in range(len(answer_list)):
	print(answer_list[y])
	y += 1


N = int(input())
for i in range(N):
	A = int(input())
	if A == 0:
		print('0')
	else:
		print(A - A // 2 - 1)


import math
n = int(input())
for i in range(n):
	a = int(input())
	y = math.ceil(a / 2) - 1
	print(y)


for i in range(int(input())):
	x = int(input())
	print([x // 2 - 1 + x % 2, 0][x == 0])


t = int(input())
otv_list = []
for i in range(t):
	otv_list.append(int((int(input()) - 0.5) // 2))
for i in otv_list:
	print(i)


x = int(input(''))
list = []
for c in range(x):
	y = int(input(''))
	if y > 2:
		if y / 2 == int(y / 2):
			list.append(int(y / 2) - 1)
		else:
			list.append(int(y / 2))
	else:
		list.append(0)
print(*list, sep='\n')


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	print(max(0, ceil((n - 2) / 2)))


def main():
	s = int(input())
	print((s - 3) // 2 + 1)
n = int(input())
for _ in range(n):
	main()


t = int(input())
for test in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	else:
		print(n - n // 2 - 1)


from sys import stdin
rInt = lambda : int(stdin.readline().strip('\n'))
rIntArray = lambda : [int(x) for x in stdin.readline().split()]
rString = lambda : stdin.readline().strip('\n')
rStrArray = lambda : [x for x in stdin.readline().split()]
for _ in range(rInt()):
	n = rInt()
	if n < 3:
		print(0)
	else:
		print((n - 1) // 2)


T = int(input())
for _ in range(T):
	candies = int(input())
	b = int(candies / 2)
	a = candies - b
	if a <= 0 or b <= 0:
		print(0)
	elif a == b:
		print(b - 1)
	else:
		print(b)


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for i in range(t):
	n = int(inp())
	if n % 2 != 0:
		print(n // 2)
	else:
		print(int(n / 2 - 1))


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


n = int(input())
for i in range(0, n):
	m = int(input())
	if m == 2 or m == 1:
		print(0)
	elif m % 2 == 0:
		print(int(m / 2 - 1))
	elif m % 2 != 0:
		print(int(m / 2 - 0.5))


import sys

class ACandiesAndTwoSisters:

	def solve(self):
		for _ in range(int(input())):
			n = int(input())
			print((n - 1) // 2)
solver = ACandiesAndTwoSisters()
input = sys.stdin.readline
solver.solve()


def nod(a, b):
	while a != b:
		(a, b) = (max(a, b), min(a, b))
		if a % b == 0:
			a -= (a // b - 1) * b
		else:
			a -= a // b * b
	return a
for i in range(int(input())):
	print((int(input()) - 1) // 2)


INT_MAX = 10 ** 18 + 7
x = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]

def cal(n):
	if n <= 2:
		return 0
	if n & 1:
		return (n - 1) // 2
	else:
		return n // 2 - 1
for _ in range(int(input())):
	n = int(input())
	print(cal(n))


def solve():
	n = int(input())
	n -= 2
	print(n - n // 2)
t = int(input())
while t > 0:
	t -= 1
	solve()


for i in range(int(input())):
	s = int(input())
	n = s // 2
	l = 2 * n - 1
	if s % 2 != 0:
		ans = min(n, l)
	else:
		ans = n - 1
	if ans < 0:
		ans = 0
	print(ans)


for q in range(int(input())):
	n = int(input())
	tmp = n // 2 + 1
	tmp1 = n - tmp
	print(tmp1)


for case in range(int(input())):
	n = int(input())
	quantos_modos = (n - 3) // 2
	if n == 3 or n == 4:
		print(1)
	elif n < 0:
		print(0)
	else:
		quantos_modos = quantos_modos + 1
		print(quantos_modos)


a = int(input())
q = []
s = 0
for i in range(a):
	z = int(input())
	if z % 2 == 0:
		s = 1
	else:
		s = 0
	q.append(z // 2 - s)
for i in range(len(q)):
	print(q[i])


x = int(input())
for a in range(x):
	y = int(input())
	if y % 2 == 1:
		print(y // 2)
	else:
		print(int(y / 2) - 1)


t = int(input())
n = list()
r = list()
while t != 0:
	n.append(int(input()))
	if n[len(n) - 1] < 3:
		r.append(0)
	else:
		r.append(n[len(n) - 1] - (int(n[len(n) - 1] / 2) + 1))
	t = t - 1
for i in r:
	print(i)


from collections import defaultdict as dd
for _ in range(int(input())):
	n = int(input())
	if n < 3:
		print(0)
	else:
		r = 0
		if n % 2 == 0:
			r += 1
		print(n // 2 - r)


T = int(input())
for _ in range(T):
	n = int(input())
	print(int((n - 0.01) / 2))


n = int(input())
posibilities = []
for i in range(n):
	c = int(input())
	if c < 3:
		posibilities.append(0)
	elif c % 2 != 0:
		posibilities.append(int(c / 2))
	else:
		posibilities.append(int(c / 2) - 1)
for i in posibilities:
	print(i)


def main():
	from sys import stdin, stdout
	n = stdin.readline()
	n = int(n)
	res = 0
	lines = stdin.readlines()
	for line in lines:
		a = int(line)
		if a < 2:
			stdout.write(str(0) + '\n')
			continue
		res = a // 2
		if a % 2 == 0:
			res -= 1
		stdout.write(str(res) + '\n')
main()


q = int(input())
while q > 0:
	q = q - 1
	count = 0
	c = int(input())
	print((c - 1) // 2)


import math
t = int(input())
for tt in range(t):
	n = int(input())
	print(math.ceil(n / 2) - 1)


def ans():
	tc = int(input())
	while tc:
		tc -= 1
		a = int(input())
		b = a / 2
		if b == int(a / 2):
			print(int(b - 1))
		else:
			print(int(b))
ans()


tests = int(input())
for i in range(tests):
	inputvalue = int(input())
	answer = inputvalue // 2
	if answer > 0:
		if inputvalue % 2 == 0:
			print(answer - 1)
		else:
			print(answer)
	else:
		print(0)


def get_input() -> str:
	raw_input_data = ''
	t = input()
	raw_input_data += t + '\n'
	for _ in range(int(t)):
		raw_input_data += input() + '\n'
	return raw_input_data

def solve(raw_input_data):
	from math import floor
	data = raw_input_data.split('\n')
	t = data[0]
	answer = ''
	for i in range(1, int(t) + 1):
		n = int(data[i])
		if n <= 2:
			answer += str(0) + '\n'
		elif n % 2 == 0:
			answer += str(floor(n / 2) - 1) + '\n'
		else:
			answer += str(floor(n / 2)) + '\n'
	return answer
while True:
	try:
		input_data = get_input()
		answer = solve(input_data)
		print(answer, end='')
	except Exception as e:
		break


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		N = int(input())
		if N < 3:
			print(0)
		elif N % 2:
			print(N // 2)
		else:
			print(N // 2 - 1)
main()


for _ in range(int(input())):
	n = int(input())
	a = n // 2 + 1
	b = n - a
	if a > b and a + b == n:
		print(min(a, b))
	else:
		print('0')


def convertArrayToInt(A):
	for i in range(0, len(A), 1):
		A[i] = int(A[i])
	return A
testCases = int(input())
while testCases:
	n = int(input())
	if n % 2 == 0:
		print(int(n / 2) - 1)
	else:
		print(int(n / 2))
	testCases -= 1


import math

def BuubleSort(n):
	if n == 0 or n == 1 or n == 2:
		return 0
	return math.ceil(n / 2) - 1

def main():
	n = int(input())
	for _ in range(n):
		a = int(input())
		ans = BuubleSort(a)
		print(ans)
main()


t = int(input())
Ans = ''
for p in range(t):
	n = int(input())
	ans = 0
	if n % 2 == 0:
		Ans += str(n // 2 - 1) + '\n'
	else:
		Ans += str(n // 2) + '\n'
print(Ans)


from sys import stdin, exit, setrecursionlimit
setrecursionlimit(10000000)
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	n = int(input())
	print((n - 1) // 2)


talika = []
for _ in range(int(input())):
	shongkha = int(input())
	if shongkha % 2 == 0:
		talika.append(int(shongkha / 2 - 1))
	else:
		talika.append(int(shongkha / 2))
print(*talika, sep='\n')


def getInts():
	return [int(s) for s in input().split()]

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

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

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

def solve():
	N = getInt()
	return (N - 1) // 2
T = getInt()
for t in range(T):
	ans = solve()
	print(ans)


def main():
	tc_count = int(input())
	for tc in range(tc_count):
		n = int(input())
		sol = n // 2
		if n % 2 == 0:
			sol -= 1
		print('{}'.format(sol))
main()


t = int(input())
for ti in range(t):
	n = int(input())
	print((n - 1) // 2)


t = int(input())
for i in range(t):
	n = int(input())
	half = n // 2
	method = n - 1 - half
	print(method)


n = int(input())
for i in range(n):
	value = int(input())
	if value % 2 == 0:
		ans = value // 2 - 1
		print(ans)
	else:
		ans = value // 2
		print(ans)


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

def main():
	test_case = int(input())
	while test_case != 0:
		a = int(input())
		solve(a)
		test_case = test_case - 1
main()


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


for q_ in range(int(input())):
	n = int(input())
	print(n // 2 - (n + 1) % 2)


size = int(input())
for i in range(size):
	a = int(input())
	if a % 2 == 0:
		temp = int(a / 2) - 1
		print(temp)
	else:
		temp = int(a / 2)
		print(temp)


def Sol(n):
	return n // 2 - 1 + n % 2
N = int(input())
for i in range(N):
	print(Sol(int(input())))


def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		if N <= 2:
			print(0)
		elif N % 2 == 0:
			print(N // 2 - 1)
		else:
			print(N // 2)
main()


q = int(input())
for i in range(q):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		d = n // 2
		print(d - 1)
	else:
		d = n // 2
		print(d)


t = int(input())
res = ''
for _ in range(t):
	n = int(input())
	res += str(int((n - 0.5) / 2)) + '\n'
print(res)


for i1 in range(int(input())):
	n = int(input())
	print((n - 1) // 2)


import math as m
t = input()
tt = int(t)
ii = 0
while ii < tt:
	n = int(input())
	b = m.floor(n / 2)
	a = m.ceil(n / 2)
	if a == b:
		print(b - 1)
	else:
		print(b)
	ii = ii + 1


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	a = n // 2 + 1
	b = n - a
	print(b)


for _ in range(int(input())):
	count = 0
	c = int(input())
	if c % 2 == 0:
		count += c / 2 - 1
	else:
		count += (c - 1) / 2
	print(int(count))


import math
import os
import random
import re
import sys
t = int(input())
for i in range(t):
	n = int(input())
	print((n - 1) // 2)


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	n = int(sys.stdin.readline().rstrip())
	re = int(n / 2)
	if n % 2 == 0:
		re -= 1
	print(re)


import math
T = int(input())
while T:
	candys = int(input())
	print(math.floor((candys - 1) / 2))
	T -= 1


import sys
import math
input = sys.stdin.readline
cases = int(input())
while cases > 0:
	candies = int(input())
	ways = math.floor(candies / 2)
	if candies % 2 == 0:
		ways -= 1
	print(ways)
	cases -= 1


from collections import Counter, defaultdict, deque
t = int(input())
for i in range(t):
	n = int(input())
	print((n - 1) // 2)


t = int(input())
for z in range(t):
	n = int(input())
	if n == 0 or n == 1 or n == 2:
		print(0)
	else:
		p = n // 2 + 1
		ans = n - p
		print(ans)


import math
for t in range(int(input())):
	n = int(input())
	a = n // 2
	b = abs(n - a)
	if a == 0 or b == 0:
		print(0)
	elif a == b:
		print(a - 1)
	elif a > b:
		print(b)
	else:
		print(a)


n = int(input())
for i in range(n):
	a = int(input())
	if a < 3:
		print(0)
	elif a >= 3 and a % 2 != 0:
		print(int(a // 2))
	elif a >= 3 and a % 2 == 0:
		print(int(a / 2 - 1))


for i in range(int(input())):
	num = int(input())
	alice = betty = 0
	alice = int(num / 2)
	alice += 1
	betty = num - alice
	if alice > betty and betty > 0:
		print(betty)
	else:
		print(0)


try:
	n = int(input())
	for i in range(0, n):
		a = int(input())
		if a % 2 == 0:
			ans = a // 2 - 1
		else:
			ans = a // 2
		print(ans)
except:
	print(n, a)


t = int(input())
cases = []
for _ in range(t):
	n = int(input())
	print(n - 1 - n // 2)


t = int(input())
while t:
	t -= 1
	n = int(input())
	min_a = n // 2 + 1
	max_a = n - 1
	print(max_a - min_a + 1)


lst = []
n = int(input())
for i in range(0, n):
	ele = int(input())
	lst.append(ele)
for ele in lst:
	if ele % 2 == 0:
		print(ele // 2 - 1)
	else:
		print(ele // 2)


import sys
import math
mod = 998244353

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 modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1 or n == 2:
		print(0)
	elif n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)


t = int(input())
for case_num in range(t):
	n = int(input())
	print((n - 1) // 2)


number = int(input())
for i in range(number):
	amount = int(input())
	if amount % 2 == 0:
		print(int(amount / 2 - 1))
	else:
		print(int((amount - 1) / 2))


t = int(input())
for j in range(t):
	n = int(input())
	print((n - 1) // 2)


test_cases = int(input())
for i in range(test_cases):
	n = int(input())
	print(int((n - 1) / 2))


t = int(input())
tab = []
for x in range(t):
	n = int(input())
	if n > 2:
		if n % 2 == 0:
			tab.append(n // 2 - 1)
		else:
			tab.append(n // 2)
	else:
		tab.append(0)
for each in tab:
	print(each)


import string
T = int(input())
for _ in range(T):
	n = int(input())
	if n % 2 == 0:
		print(int(n / 2 - 1))
	if n % 2 == 1:
		print(int((n - 1) / 2))


n = int(input())
count = 0
d = []
while count < n:
	s = int(input())
	d.append(s)
	count += 1
for x in d:
	if x == 0:
		print(0)
	elif x % 2 == 0:
		b = x // 2 - 1
		print(b)
	else:
		b = x // 2
		print(b)


n = input()
i = 1
n = int(n)
while i <= n:
	ch = input()
	ch = int(ch)
	if ch % 2 == 0:
		print(int(ch / 2 - 1))
	else:
		print(int((ch - 1) / 2))
	i = i + 1


t = int(input())
numbers = []
for i in range(t):
	number = int(input())
	if number % 2 == 0:
		numbers.append(number // 2 - 1)
	else:
		numbers.append(number // 2)
for i in numbers:
	print(i)


import math
t = int(input())
outputs = []
for i in range(t):
	n = int(input())
	outputs.append(math.ceil(n / 2) - 1)
for i in range(t):
	print(outputs[i])


import sys
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize
sys.setrecursionlimit(10 ** 7)
mod = 1000000007

def IOE():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	t = int(sys.stdin.readline())
	for _ in range(t):
		n = int(sys.stdin.readline())
		if n & 1:
			print(n // 2)
		else:
			print(n // 2 - 1)
try:
	IOE()
except:
	pass
main()


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


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def print_list_int(l):
	print(' '.join(map(str, map(int, l))))
t = inp()
for i in range(t):
	n = inp()
	print(int((n - 1) // 2))


a = input()
test_cases = []
for i in range(int(a)):
	test_cases.append(int(input()))
for t in test_cases:
	if t == 0 or t == 1 or t == 2:
		print(0)
	elif t % 2 == 0:
		print(int((t - 1) / 2 - 0.5))
	else:
		print(int(t / 2 - 0.5))


from bisect import bisect_left as lower_bound, bisect_right as upper_bound
from sys import stdin, stdout
from collections import defaultdict

def solve(arr, n):
	pass

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		ret = -1
		if n & 1:
			ret = n // 2
		else:
			ret = n // 2 - 1
		print(ret)
main()


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


c = int(input())
for i in range(c):
	x = int(input())
	print(int((x - 1) / 2))


for _ in range(int(input())):
	n = int(input())
	f = 1
	l = n - 1
	if n == 0 or n == 1:
		print(0)
	elif l % 2 == 0:
		print(l // 2)
	else:
		print((l - 1) // 2)


n = int(input())
s = []
for i in range(n):
	a = int(input())
	k = int(a / 2)
	k1 = a - k - 1
	s.append(k1)
for i in range(n):
	print(s[i])


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	b = n // 2
	a = n - b
	if a == b:
		b -= 1
	print(b)


n = int(input())
for i in range(n):
	ssum = int(input())
	choice_a = int((ssum - 1) / 2)
	print(choice_a)


import math
loop_time = int(input())
for time in range(0, loop_time):
	n = int(input())
	if n % 2 == 0:
		print(int(n / 2 - 1))
	else:
		print(math.floor(n / 2))


import sys
import io, os
import math
import bisect

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n % 2 == 1:
			print(n // 2)
		else:
			print(n // 2 - 1)
main()