#include <bits/stdc++.h>
using namespace std;
template <typename _T>
void read(_T &x) {
  _T f = 1;
  x = 0;
  char s = getchar();
  while (s > '9' || s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 3) + (x << 1) + (s ^ 48);
    s = getchar();
  }
  x *= f;
}
long long t, n;
long long check(long long mid) {
  long long tmp = (mid * mid - mid) / 2LL;
  if (n - mid >= tmp)
    return tmp + n - mid;
  else if (n - mid >= mid - 1)
    return (n - mid) * 2LL;
  return mid - 1;
}
signed main() {
  read(t);
  while (t--) {
    read(n);
    if (n == 1) {
      puts("0");
      continue;
    }
    long long l = 1, r = n;
    while (l < r - 1) {
      long long mid1 = l + r >> 1;
      long long mid2 = r + mid1 >> 1;
      if (check(mid1) > check(mid2))
        r = mid2;
      else
        l = mid1;
    }
    printf("%lld\n", max(check(l), check(r)));
  }
  return 0;
}
