#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int x = 0;
    x = n / 2;
    if (n % 2 == 0) x--;
    cout << x << "\n";
  }
}
