#include <bits/stdc++.h>
using namespace std;
long long q;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    if (n == 1) {
      cout << "0\n";
      continue;
    }
    long double ex = 2 * n + 1;
    ex -= (long double)sqrt((long double)8 * n + 1);
    ex /= 2;
    long long x = ex, y = x + 1;
    cout << max(min(2 * x, (n - x) * (n - x - 1) / 2 + x),
                min(2 * y, (n - y) * (n - y - 1) / 2 + y))
         << "\n";
  }
  return 0;
}
