#include <bits/stdc++.h>
using namespace std;
long long q;
long long qtd(long long x) { return (x - 1) * x / 2; }
bool deu(long long x, long long mid) {
  if (mid <= 2) return true;
  return qtd(mid) <= x - mid;
}
long long solve(long long x) {
  long long bot = 0, top = x, mid;
  while (top - bot > 1) {
    mid = (top + bot) / 2;
    if (deu(x, mid))
      bot = mid;
    else
      top = mid;
  }
  if (deu(x, top)) bot = top;
  long long ans = x - 1;
  ans = max(ans, qtd(bot) + x - bot);
  ans = max(ans, x - bot - 1 + min(x - bot - 1, qtd(bot + 1)));
  return ans;
}
int main() {
  cin >> q;
  for (int i = 0; i < q; i++) {
    long long x;
    cin >> x;
    cout << solve(x) << endl;
  }
}
