#include <bits/stdc++.h>
using namespace std;
void fileIO() {
  freopen("immetric.in", "r", stdin);
  ;
  freopen("immetric.out", "w", stdout);
  ;
}
int main() {
  int t;
  scanf("%d", &t);
  for (int z = 1; z <= t; z++) {
    long long n;
    scanf("%lld", &n);
    if (n & 1)
      cout << n / 2 << endl;
    else
      cout << n / 2 - 1 << endl;
  }
  return 0;
}
