#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-16;
const long long MODP = (int)1e9 + 7;
const long long INF = (int)1e9 + 10;
const int N = 60;
template <typename T>
vector<T> readVector0(int n) {
  vector<T> res(n);
  for (int i = 0; i < n; i++) cin >> res[i];
  return res;
}
template <typename T>
vector<T> readVector1(int n) {
  vector<T> res(n + 1);
  for (int i = 1; i <= n; i++) cin >> res[i];
  return res;
}
inline long long mod(long long x, long long m = MODP) {
  if (x < 0) x += m;
  return (x % m);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q, n;
  vector<long long> ans;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    cin >> n;
    long long k = ((sqrt((double)n * 8 + 1) - 1) / 2);
    long long res = (n - k) + (k * (k - 1) / 2);
    if (2 * (n - k - 1) > res) res = 2 * (n - k - 1);
    ans.push_back(res);
  }
  for (int i = 0; i < q; ++i) cout << ans[i] << endl;
  return 0;
}
