/*
Bismillahir Rahmanir Rahim
(In the name of Allah)
@Author Muhammad Nadim
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define CheckBit(x, k) (x & (1LL << k))
#define SetBit(x, k) (x |= (1LL << k))
#define ClearBit(x, k) (x &= ~(1LL << k))
#define LSB(mask) __builtin_ctzll(mask)
#define MSB(mask) 63 - __builtin_clzll(mask)
#define print(x) cout << #x << " : " << x << endl
#define error1(x) cerr << #x << " = " << (x) << endl
#define coutall(v) \
for (auto &it : v) \
cout << it << ' '; \
cout << endl
#define Abid_52 \
ios::sync_with_stdio(false); \
cin.tie(0), cin.tie(0)
#define error2(a, b) cerr << "( " << #a << " , " << #b << " ) = ( " << (a) << " , " << (b) << " )\n"
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()
template <typename T, typename U>
T ceil(T x, U y) { return (x > 0 ? (x + y - 1) / y : x / y); }
template <typename T, typename U>
T floor(T x, U y) { return (x > 0 ? x / y : (x - y + 1) / y); }
#define ld long double
#define nl '\n'
#define pi acos(-1.0)
#define sp(n) fixed << setprecision(n)
#define MNTDH_18 \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define yes cout << "YES" << "\n"
#define no cout << "NO" << "\n"
// #define all(v) v.begin(), v.end()
#define CheckBit(x, k) (x & (1LL << k))
#define SetBit(x, k) (x |= (1LL << k))
#define ClearBit(x, k) (x &= ~(1LL << k))
#define LSB(mask) __builtin_ctzll(mask)
#define MSB(mask) 63 - __builtin_clzll(mask)
// template <typename T, typename U>
// T ceil(T x, U y) { return (x > 0 ? (x + y - 1) / y : x / y); }
// template <typename T, typename U>
// T floor(T x, U y) { return (x > 0 ? x / y : (x - y + 1) / y); }
// typedef __int128 lll;
typedef struct rafi
{
ll type;
ll idx1;
ll idx2;
} R;
typedef struct sajeeb
{
ll val1;
ll val2;
} S;
typedef struct ohi
{
ll l;
ll r;
ll u;
ll d;
int val;
} O;
const int N = 2e5 + 7, M = 1073741824, N1 = 64;
bool isPowerOfTwo(int n)
{
if (n == 0)
return false;
return (ceil(log2(n)) == floor(log2(n)));
}
void sF()
{
ll n;
cin>>n;
cout<<((n-1)>>1)<<nl;
}
int main()
{
MNTDH_18
// pow2();
ll tc = 1, x = 1;
cin >> tc;
while (tc--)
{
// cout << "Case " << x++ << ": ";
sF();
}
return 0;
}