#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int n;
long long res;
long long fun(int val) {
  int sval = n - val + 1;
  long long tres = val - 1 + (sval * 1LL * (sval - 1)) / 2;
  if ((2LL * (val - 1)) < tres) tres = 2LL * (val - 1);
  res = max(res, tres);
  return tres;
}
void terSearch() {
  int l = 1, h = n;
  while (l <= h) {
    int m1 = l + (h - l) / 3, m2 = h - (h - l) / 3;
    long long f1 = fun(m1), f2 = fun(m2);
    if (f1 < f2)
      l = m1 + 1;
    else
      h = m2 - 1;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt;
  cin >> tt;
  while (tt--) {
    cin >> n;
    res = -1;
    terSearch();
    cout << res << "\n";
  }
  return 0;
}
