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