#include <bits/stdc++.h>
using namespace std;
long long int pow(int a, int b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return pow(a * a, b / 2);
  else
    return a * pow(a * a, b / 2);
}
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
void solve() {
  long long n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n / 2 - 1 << endl;
    return;
  } else {
    cout << n / 2 << endl;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
