#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    long long x = sqrt(2 * n);
    if (x * (x + 1) <= 2 * n) x++;
    cout << n + max(n, (x * x - x) / 2 + 2) - x - x << endl;
  }
}
