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