#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long number;       cin >> number;       if (number == 2) {         cout << 0 << endl;       } else if (number == 1) {         cout << 0 << endl;       } else {         if (number % 2 == 0) {           cout << number / 2 - 1 << endl;         } else {           cout << number / 2 << endl;         }       }     }     return 0;   }   