#include <bits/stdc++.h>
int main() {
  long long int t, n;
  scanf("%lld", &t);
  while (t > 0) {
    scanf("%lld", &n);
    if (n % 2 != 0)
      printf("%lld\n", n / 2);
    else
      printf("%lld\n", (n - 1) / 2);
    t--;
  }
  return 0;
}
