#include <bits/stdc++.h>
using namespace std;
int T, n;
int check(long long md) {
  return ((n - 1 - md) + (md == 1)) >= md * (md + 1) / 2;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    long long as = 0;
    long long l = 0, r = n - 1, md;
    while (l < r) {
      md = (l + r + 1) >> 1;
      if (check(md))
        l = md;
      else
        r = md - 1;
    }
    as = l * (l - 1) / 2 + n - 1;
    as += max(0ll, (n - 1 - l - 2) - (l + 1) * (l) / 2);
    cout << as << endl;
  }
  return 0;
}
