#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long ans = 0, ret = 0;
    for (long long step = (1LL << 40); step; step /= 2) {
      if (ans + step >= n) continue;
      ans += step;
      long long rem = n - ans;
      rem = rem * (rem - 1) / 2;
      if (rem < ans) {
        ret = max(ret, ans + rem);
        ans -= step;
      }
    }
    cout << max(ret, 2 * ans) << endl;
  }
  return 0;
}
