//MJRT #include #include #include #include ////////////////////// #include #include #include #include #include #include #include /////////////////////// #include #include #include #include #include #include #include /////////////////////// //#include //pd_bs库,hdu&&poj不支持 using namespace std; #define lowbit(x) ((x)&(-x)) static int INDEX = 0,BUGs = 0; template inline void gmax(T1 &a, T2 b) { if (b>a)a = b; } template inline void gmin(T1 &a, T2 b) { if (b>1; int main() { //ios::sync_with_stdio(false); #ifndef ONLINE_JUDGE //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); #endif int Case; LL n; scanf("%d",&Case); while(Case--) { scanf("%I64d",&n); LL ans = 0; LL m = n-1; for(LL i = 2 ; i <= n ; i++,m--) { ans += m; ans %= i; } printf("%I64d\n",ans+1); } return 0; }