#include <bits/stdc++.h>
using namespace std;
long long getPos(long long edge) {
  long long a = (sqrtl(1 + 8 * edge) - 1) / 2;
  while ((long long)(a + 1) * a < 2 * edge) a++;
  return a + 1;
}
bool check(long long n, long long edge) {
  long long pos = getPos(edge);
  if (n - pos >= edge) return 1;
  return 0;
}
int main() {
  long long q;
  scanf("%lld", &q);
  while (q--) {
    long long n;
    scanf("%lld", &n);
    if (n <= 5) {
      printf("%lld\n", n - 1);
      continue;
    }
    long long l = 3, r = 2 * n;
    while (l < r) {
      long long mid = l + r >> 1;
      if (check(n, mid))
        l = mid + 1;
      else
        r = mid;
    }
    l--;
    printf("%lld\n", l + n - getPos(l));
  }
  return 0;
}
