#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 35;
const int N = 2e5;
const long long mod = 1e7;
const double eps = 1e-6;
int a[MAX];
long long n;
long long ans;
pair<long long, long long> ch(long long x) {
  long long x2 = n - x;
  long long s = x;
  s += (x2 * (x2 - 1)) / 2;
  if (((s + 1) / 2) >= x) {
    pair<long long, long long> k;
    k.first = 1;
    k.second = min(x * 2, s);
    return k;
  } else
    return {0, 0};
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  int t;
  cin >> t;
  while (t--) {
    ans = 0;
    cin >> n;
    if (n == 1) {
      cout << "0\n";
      continue;
    }
    long long l = 0;
    long long r = n - 1;
    while (l <= r) {
      long long mid = (l + r) / 2;
      if (ch(mid).first) {
        ans = max(ans, ch(mid).second);
        l = mid + 1;
      } else
        r = mid - 1;
    }
    cout << ans << "\n";
  }
  return 0;
}
