#include <bits/stdc++.h>
using namespace std;
signed main() {
  auto sgn = [&](int x) {
    if (x > 0)
      return 1;
    else
      return -1;
  };
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
lp:
  while (t--) {
    int n;
    cin >> n;
    if (n % 2 == 0)
      cout << n / 2 - 1;
    else
      cout << n / 2;
    cout << '\n';
  }
}
