#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1000005;
int q;
int n;
int C(long long x) { return x <= (n - x) * (n - x - 1) / 2; }
int main() {
  scanf("%d", &q);
  for (int cas = (0); cas < (q); cas++) {
    scanf("%d", &n);
    long long l = 0, r = n;
    while (r - l > 1) {
      long long m = l + r >> 1;
      if (C(m))
        l = m;
      else
        r = m;
    }
    long long ans = (min(l * 2LL, l + 1LL * ((n - l) * (n - l - 1)) / 2));
    if (l + 1 < n)
      ans = max(ans, min(2LL * (l + 1),
                         l + 1 + 1LL * ((n - l - 1) * (n - l - 2)) / 2));
    cout << ans << endl;
  }
}
