#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  if (n % 2)
    cout << n / 2 << "\n";
  else
    cout << n / 2 - 1 << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  clock_t start, end;
  start = clock();
  long long tc;
  cin >> tc;
  for (long long i = 1; i <= tc; i++) solve();
  end = clock();
  double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
}
