#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    long long n;
    scanf("%lld", &n);
    long long l = 1, r = n;
    long long ans = -1;
    while (l <= r) {
      long long mid = (l + r) / 2;
      if (mid * (mid + 1) <= 2 * n) {
        ans = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    printf("%lld ", max((n - ans + min((ans * (ans - 1) / 2), n - ans)),
                        (n - ans - 1 + min(ans * (ans + 1) / 2, n - ans - 1))));
    printf("\n");
  }
  return 0;
}
