#include <bits/stdc++.h>
using namespace std;
long long ans = 1, ma = 0, f = 1;
vector<long long> v;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    if (n % 2 == 0)
      cout << n / 2 - 1 << endl;
    else
      cout << n / 2 << endl;
  }
  return 0;
}
