#include <bits/stdc++.h>
using namespace std;
int arr[100001];
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  long long x = 0, b = 0, c = 0;
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n % 2 == 0) {
      x = (n / 2);
      cout << x - 1 << "\n";
    } else
      cout << n / 2 << "\n";
  }
  return 0;
}
