#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 7;
const int maxn = 200005;
const double pi = acos(-1.0);
using db = double;
int main() {
  int t;
  cin >> t;
  ll x;
  while (t--) {
    cin >> x;
    ll l = 0, r = x / 2 + 1;
    ll ans1 = 0, ans2 = 0;
    while (r - l > 1) {
      ll mid = (r + l) / 2;
      if ((mid - 1) * (mid - 2) / 2 < x - mid) {
        l = mid;
        ans1 = mid;
        ans2 = x - mid;
      } else {
        r = mid;
      }
    }
    if (x == 1)
      cout << 0 << '\n';
    else {
      ll ans = ans2 + min(ans1 * (ans1 - 1) / 2, ans2);
      cout << ans << '\n';
    }
  }
  return 0;
}
