#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int ret = 0, f = 1;
  for (; c < '0' || c > '9'; f = c == '-' ? -1 : 1, c = getchar())
    ;
  for (; '0' <= c && c <= '9'; ret = ret * 10 + c - '0', c = getchar())
    ;
  return ret * f;
}
int main() {
  for (int T = read(); T; T--) {
    int n = read();
    if (n <= 5) {
      printf("%d\n", n - 1);
    } else {
      int l = 2, r = n, x, ret = -1;
      while (l <= r) {
        x = l + r >> 1;
        if ((long long)x * x + x <= 2ll * n) {
          ret = x;
          l = x + 1;
        } else {
          r = x - 1;
        }
      }
      assert(ret >= 0);
      printf("%lld\n",
             max(n - ret + ret * (ret - 1ll) / 2, n - ret - 1ll << 1));
    }
  }
  return 0;
}
