#include <bits/stdc++.h>
using namespace std;
void fastscan(int &number) {
  bool negative = false;
  register int c;
  number = 0;
  c = getchar();
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;
  if (negative) number *= -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int aa = 0;
  int bb = 0;
  int t;
  fastscan(t);
  while (t--) {
    int n;
    fastscan(n);
    cout << (n - 1) / 2 << endl;
  }
  return 0;
}
