#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline vector<T> readvector(size_t size) {
  vector<T> res(size);
  for (size_t i = 0; i < size; ++i) {
    cin >> res[i];
  }
  return res;
}
long long mylog(long long n) { return 63 - __builtin_clzll(n); }
template <typename T>
inline void printvector(vector<T> &arr, string sep = " ", string ends = "\n") {
  for (size_t i = 0; i < arr.size(); ++i) {
    cout << arr[i] << sep;
  }
  cout << ends;
}
inline long long binPow(long long first, long long deg, long long mod) {
  long long ans = 1;
  for (long long i = sizeof(first) * CHAR_BIT - 1; i >= 0; i--) {
    ans *= ans;
    ans %= mod;
    if ((((deg) >> (i)) & 1)) ans *= first;
    ans %= mod;
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  while (n--) {
    long long a;
    cin >> a;
    cout << (a - 1) / 2 << endl;
  }
  return 0;
}
