#include <bits/stdc++.h>
using namespace std;
void _dbg(string) { cout << endl; }
template <class H, class... T>
void _dbg(string s, H h, T... t) {
  int l = s.find(',');
  cout << s.substr(0, l) << " = " << h << ", ";
  _dbg(s.substr(l + 1), t...);
}
template <class T, class U>
ostream& operator<<(ostream& o, const pair<T, U>& p) {
  o << "(" << p.first << "," << p.second << ")";
  return o;
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  o << "[";
  for (T t : v) {
    o << t << ",";
  }
  o << "]";
  return o;
}
inline long long f(long long n, long long x) {
  return x + min(x, (n - x) * (n - x - 1) / 2);
}
int main() {
  int q;
  cin >> q;
  for (int _ = (int)(0); _ < (int)(q); _++) {
    long long n;
    scanf("%lld", &n);
    double xx = ((1 + 2 * n) - sqrt(8 * n + 1)) / 2.0;
    long long res = max({f(n, xx - 1), f(n, xx + 1), f(n, xx)});
    if (n == 1) res = 0;
    printf("%lld\n", res);
  }
  return 0;
}
