// Bismillah hir-rahman nir-raheem
// Shakib Absar - (_rasbaris)
#include<bits/stdc++.h>
#include <tuple>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define tc() ll t; cin>>t; while(t--)
#define endl '\n'
#define debug(x) cout << " >> " << #x << " : " << x << endl
#define yes printf("Yes\n")
#define no printf("No\n")
#define PI acos(-1.0)
#define Case(csNo) cout <<"Case "<<csNo++<<": ";
#define all(v) (v).begin(),(v).end()
#define print(v) for(auto &i:v)cout<<i<<' ';
#define _rasbaris_ ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
// cout << "Case "<<q<<": ";
using namespace std;
const ll M = 1e9;
// 4 direction
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int main()
{
//_rasbaris_
// 1 2 3 4 5 6 7 8 9 10
tc()
{
ll n ; cin >> n;
cout << (n-1)/2 << endl;
}
return 0;
}