#include <bits/stdc++.h>
using namespace std;
const long long I1 = 1e9;
const long long I2 = 1e18;
const int32_t M1 = 1e9 + 7;
const int32_t M2 = 998244353;
template <typename T, typename T1>
T maxn(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T minn(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
void solve() {
  long long int n;
  cin >> n;
  if (n == 1) {
    cout << "0"
         << "\n";
    return;
  }
  long long int l = 1, r = n - 1, m1, m2, ans = 0;
  while (l <= r) {
    m1 = l + (r - l) / 3, m2 = r - (r - l) / 3;
    long long int c1, c2;
    c1 = min(2 * m1, m1 + ((n - m1) * (n - m1 - 1)) / 2);
    c2 = min(2 * m2, m2 + ((n - m2) * (n - m2 - 1)) / 2);
    ans = max({ans, c1, c2});
    if (c1 > c2)
      r = m2 - 1;
    else if (c2 > c1)
      l = m1 + 1;
    else {
      l = m1 + 1, r = m2 - 1;
    }
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int testcase = 1;
  cin >> testcase;
  while (testcase--) solve();
  return 0;
}
