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