#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30) - 1 + (1 << 30);
const int mod = 1e9 + 7;
template <typename T>
void gi(T &ret) {
  ret = 0;
  char inp = getchar();
  int kl = 1;
  while (inp < '0' || inp > '9') {
    if (inp == '-') kl = -1;
    inp = getchar();
  }
  while ('0' <= inp && inp <= '9')
    ret = (ret << 3) + (ret << 1) + (inp - '0'), inp = getchar();
  if (kl < 1) ret = -ret;
}
bool valid(long long n, long long x) {
  long long b = (x + 1) / (long long)2;
  if (n <= b) return 0;
  n -= b;
  x -= b;
  if (((n * (n - 1)) / (long long)2) >= x) return 1;
  return 0;
}
int main() {
  int q;
  gi(q);
  while (q--) {
    long long n, l, r;
    gi(n);
    l = n - 1;
    r = (n * (n - 1)) / (long long)2;
    while (l < r) {
      long long mid = (l + r + 1) / (long long)2;
      if (valid(n, mid))
        l = mid;
      else
        r = mid - 1;
    }
    printf("%lld\n", l);
  }
  return 0;
}
