#include <bits/stdc++.h>
using namespace std;
void answer() {
  long int n;
  cin >> n;
  if (n & 1) {
    cout << n / 2;
  } else
    cout << (n / 2) - 1;
  cout << endl;
}
int main() {
  long int t;
  cin >> t;
  while (t--) {
    answer();
  }
}
