#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
vector<long long> gr[200001];
vector<long long> grev[200001];
long long hm[200001];
long long vis[200001];
long long a[200005];
long long b[200005];
long long x[200005];
vector<long long> arr;
void solve() {
  long long n;
  cin >> n;
  if (n % 2) {
    cout << n / 2 << endl;
  } else {
    cout << (n / 2) - 1 << endl;
  }
}
int main() {
  long long t;
  t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
