#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a;
  cin >> a;
  long long b[a];
  for (long long i = 0; i < a; i += 1) {
    cin >> b[i];
  }
  for (long long i = 0; i < a; i += 1) {
    if (b[i] % 2 == 0)
      cout << (b[i] - 2) / 2 << endl;
    else if (b[i] % 2 != 0)
      cout << (b[i] - 1) / 2 << endl;
  }
}
