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