#include <bits/stdc++.h>
using namespace std;
int main() {
  cout << fixed;
  cout.precision(9);
  int t;
  cin >> t;
  while (t-- > 0) {
    int n;
    cin >> n;
    n -= 2;
    if (n < 0) n = 0;
    cout << n << "\n";
  }
  return 0;
}
