#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
int main() {
  int q, n;
  long long ansl, ansr;
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &n);
    ansl = n - 1;
    ansr = 1LL * n * (n - 1) / 2;
    while (ansl < ansr) {
      long long m = (ansl + ansr) / 2 + 1;
      long long d = m - n + 1;
      long long k = sqrt(2 * d + 0.25) + 0.5;
      if (k * (k - 1) / 2 < d) ++k;
      if (n - 1 - k >= (m + 1) / 2)
        ansl = m;
      else
        ansr = m - 1;
    }
    printf("%I64d\n", ansr);
  }
  return 0;
}
