#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 9;
const int N = 2e5 + 10;
int main() {
  int ncase;
  cin >> ncase;
  while (ncase--) {
    int n;
    cin >> n;
    printf("%d\n", max(0, n - 2));
  }
  return 0;
}
