#include <bits/stdc++.h>
using namespace std;
int Q, n;
int main() {
  scanf("%d", &Q);
  while (Q--) {
    scanf("%d", &n);
    long long mid, ans = n - 1, l = 2, r = n - 1;
    while (l <= r) {
      mid = (l + r) / 2;
      if (mid * (mid - 1ll) / 2 + (n - mid) <= 2ll * (n - mid))
        l = mid + 1;
      else
        r = mid - 1;
    }
    mid = l - 1;
    ans = max(ans, min(mid * (mid - 1ll) / 2 + n - mid, 2ll * (n - mid)));
    mid = l;
    ans = max(ans, min(mid * (mid - 1ll) / 2 + n - mid, 2ll * (n - mid)));
    printf("%lld\n", ans);
  }
}
