#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, i1;
  long long n, st, dr, mij, rasp;
  scanf("%d", &q);
  for (i1 = 1; i1 <= q; i1++) {
    scanf("%lld", &n);
    st = 0;
    dr = n;
    while (st + 1 < dr) {
      mij = (st + dr) / 2;
      if (mij < (n - mij) * (n - mij - 1) / 2)
        st = mij;
      else
        dr = mij;
    }
    rasp = 2 * st;
    if (st != n - 1) rasp = max(rasp, st + 1 + (n - st - 1) * (n - st - 2) / 2);
    printf("%lld\n", rasp);
  }
  return 0;
}
