Help me in solving CNPIIM problem

My issue

plz give me an approach

My code

#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	ll t;
	cin>>t;
	while(t--){
	    ll n;
	    cin>>n;
	    ll x=n;
	    ll ans=0;
	 while(n>0){
	     ll i=n-1;
	     ll j=x-i;
	     if(i>0 && j>0){
	         ans++;
	         
	     }
	       n--;
	 }
	 cout<<ans<<endl;
	}
	return 0;
}

Problem Link: CNPIIM Problem - CodeChef

@deepakjdh31
Hint :- think of the solution more mathematically(Like how many options u can have at each cell)