#include <bits/stdc++.h>
using namespace std;
int ok(long long cnt, int n) {
  long long bridge = (cnt + 1) >> 1LL;
  if ((long long)(n - bridge) * (n - bridge - 1) >= 2 * (cnt - bridge))
    return 1;
  else
    return 0;
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    scanf("%d", &n);
    long long st = 0, ed = (n - 1) * 2LL + 1;
    while (ed > st + 1) {
      long long mid = (st + ed) >> 1LL;
      if (ok(mid, n))
        st = mid;
      else
        ed = mid;
    }
    printf("%I64d\n", st);
  }
  return 0;
}
