#include <bits/stdc++.h>
int q;
long long n;
long long lo, hi, mid;
long long l1, ans;
int main() {
  scanf("%d", &q);
  while (q--) {
    scanf("%I64d", &n);
    if (n <= 5)
      printf("%d\n", n - 1);
    else {
      lo = 3;
      hi = n;
      while (lo < hi) {
        mid = (lo + hi + 1) / 2;
        l1 = ((mid - 1) * mid) / 2;
        if (l1 <= n - mid)
          lo = mid;
        else
          hi = mid - 1;
      }
      ans = ((lo - 1) * lo) / 2 + n - lo;
      hi = lo + 1;
      if (ans < (n - hi) * 2) ans = (n - hi) * 2;
      printf("%lld\n", ans);
    }
  }
}
