#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int ddx[] = {0, 0, 1, 1, 1, -1, -1, -1}, ddy[] = {1, -1, 1, 0, -1, 1, 0, -1};
long long res(long long n, long long k) {
  return n - k + min(k * (k - 1) / 2, n - k);
}
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    long long n;
    scanf("%lld", &n);
    if (n <= 2) {
      printf("%lld\n", n - 1);
      continue;
    }
    long long l = 1, r = n;
    while (l <= r) {
      long long k = (l + r) >> 1;
      if (res(n, k) >= res(n, k - 1))
        l = k + 1;
      else
        r = k - 1;
    }
    printf("%lld\n", res(n, r));
  }
}
