#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sp " "
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
void messi()
{
int n;
cin >> n;
if (n % 2 == 1)
{
cout << n / 2 << endl;
}
else
{
cout << n / 2 - 1 << endl;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
ll tc = 1;
cin >> tc;
while (tc--)
{
messi();
}
return 0;
}