#include <bits/stdc++.h>
using namespace std;
int solve() {
  long long n;
  cin >> n;
  return (n - 1) / 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    cout << solve() << endl;
  }
}
