    /*author:	Slns*/

#include <bits/stdc++.h>

#define _USE_MATH_DEFINES
#define pb push_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair < int, int > pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

void NITRO(){
	//OneInOneOut
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

const int N = 1e+5 + 11;
const ll MOD = 1e+9 + 7;
const int inf = int(1e9);
const ll INF = ll(1e16);

void SOLVE(/*WATLE*/) {
    int n, i = 1, s = 0, p = 1;
    cin >> n;
    while(s < n) {
        s += i, i++, p++;
    }
    s -= n;
    //cout << s << " ";
    while(s > 0 && p > 1) {
        if(p <= s) s -= p;
        p--;
    }
    cout << i - 1 + s << '\n';
}

int main() {
    //  freopen("slalom.in", "r", stdin);
    //  freopen("slalom.out", "w", stdout);
    NITRO();
    int times = 1;
    cin >> times;
    for(int i = 1; i <= times; i++) {
        //cout << "Case #" << t << ": ";
        SOLVE();
    }
    return 0;
}
