#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  double n;
  cin >> t;
  while (t--) {
    scanf("%lf", &n);
    double ans;
    ans = ceil(n / 2) - 1;
    printf("%.0lf\n", ans);
  }
  return 0;
}
