#include <bits/stdc++.h>
using namespace std;
long long node;
long long solve() {
  long long i = 0, k;
  long long ret, ans = -1;
  ret = (-1 + sqrt(1 + 8 * node)) / 2;
  ret -= 2;
  if (ret < 0) ret = 0;
  for (i = 0; i < 6; i++) {
    k = ret + i;
    k = node - k + min((k * (k - 1)) / 2, node - k);
    ans = max(ans, k);
  }
  return ans;
}
int main() {
  int q, t;
  scanf("%d", &q);
  for (t = 1; t <= q; t++) {
    scanf("%lld", &node);
    if (node < 6) {
      printf("%lld\n", node - 1);
      continue;
    }
    long long ans = solve();
    printf("%lld\n", ans);
  }
  return 0;
}
