#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vll = vector<ll>;
using pdd = pair<double, double>;
using vpdd = vector<pdd>;
template <typename T>
using uset = unordered_set<T>;
template <typename T>
using umultiset = unordered_multiset<T>;
template <typename K, typename V>
using umap = unordered_map<K, V>;
template <typename K, typename V>
using umultimap = unordered_multimap<K, V>;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, -1, 1};
const double eps = 1e-9;
const int INF = 0x7FFFFFFF;
const ll INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);
template <typename T>
T take(queue<T>& O) {
  T tmp = O.front();
  O.pop();
  return tmp;
}
template <typename T>
T take(stack<T>& O) {
  T tmp = O.top();
  O.pop();
  return tmp;
}
template <typename T>
T take(priority_queue<T>& O) {
  T tmp = O.top();
  O.pop();
  return tmp;
}
template <typename T>
inline bool inRange(const T& z, const T& a, const T& b) {
  return a <= z && z <= b;
}
void OPEN(const string& in = "input.txt", const string& out = "output.txt") {
  freopen(in.c_str(), "r", stdin);
  freopen(out.c_str(), "w", stdout);
  return;
}
ll q, n;
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> q;
  for (int(tc) = (1), _t = (q); tc <= (_t); ++(tc)) {
    cin >> n;
    ll ans = 0LL;
    if (n == 1) {
      cout << 0 << "\n";
    } else if (n == 2) {
      cout << 1 << "\n";
    } else if (n == 3) {
      cout << 2 << "\n";
    } else {
      ll lo = 0, hi = n, mid;
      while (lo < hi) {
        mid = (lo + hi + 1) >> 1;
        ll sisa = n - (mid - 1);
        if (mid - 1 >= (sisa * (sisa - 1)) >> 1) {
          hi = --mid;
        } else {
          lo = mid;
        }
      }
      lo = ++hi;
      ll ans = n - (lo - 1);
      ll edgePenuh = (ans * (ans - 1)) >> 1;
      ans = edgePenuh;
      ans += lo - 1;
      ll trueAns = ans;
      ll sisa = n - lo;
      ll kanan = edgePenuh + 1 + sisa;
      ll kiri = lo - 2;
      trueAns = max(trueAns, kiri + min(kiri, kanan));
      cout << trueAns << "\n";
    }
  }
}
