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