#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    long long n;
    cin >> n;
    if (n <= 5) {
      cout << n - 1 << endl;
      continue;
    }
    long long l = 2, r = n;
    while (l + 1 != r) {
      long long m = (l + r) / 2;
      if ((m + 1) * m / 2 <= n - m - 1) {
        l = m;
      } else {
        r = m;
      }
    }
    cout << max((l + 1) * l / 2 + n - l - 1, 2 * (n - l - 2)) << endl;
  }
}
