#include <bits/stdc++.h>
using namespace std;
long long n;
inline long long C(long long x, int y = 2) {
  if (x <= 1) return x - 1;
  return x * (x - 1) / 2;
}
inline long long check(long long x) {
  if (n == x) return n - 1;
  return x + min(C(n - x), x);
}
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    scanf("%I64d", &n);
    long long s = 2, e = n;
    while (s < e) {
      long long m = (s + e) / 2;
      long long mid = (s + m) / 2;
      if (check(m) > check(mid)) {
        s = mid + 1;
      } else {
        e = m;
      }
    }
    printf("%I64d\n", max(check(s), check(e)));
  }
  return 0;
}
