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