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