#include <bits/stdc++.h>
using namespace std;
long long a[5][5];
void print(long long r, long long c, long long k) {
  if (r < 0 || c < 0 || r == 5 || c == 5 || a[r][c] != 0) return;
  if (k == 25) {
    a[r][c] = k;
    for (long long i = 0; i < 5; i++) {
      for (long long j = 0; j < 5; j++) cout << a[i][j] << " ";
      cout << endl;
    }
    return;
  }
  a[r][c] = k;
  print(r - 2, c + 1, k + 1);
  print(r - 1, c + 2, k + 1);
  print(r - 2, c + 1, k + 1);
  print(r - 2, c + 1, k + 1);
  print(r - 2, c + 1, k + 1);
  print(r - 2, c + 1, k + 1);
  print(r - 2, c + 1, k + 1);
  print(r - 2, c + 1, k + 1);
  a[r][c] = 0;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long test;
  cin >> test;
  while (test--) {
    long long n;
    cin >> n;
    if (n & 1)
      cout << n / 2 << endl;
    else
      cout << n / 2 - 1 << endl;
  }
}
