#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const double PI = 3.141592653528;
const long long INF = 10000000000000000;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    cout << max(0, n - 2) << "\n";
  }
  return 0;
}
