#include <bits/stdc++.h>
using namespace std;
int Q;
long long int N;
int cheats[20] = {0, 0, 1, 2, 3, 4, 6, 7, 8, 10, 12};
int main() {
  scanf("%d", &Q);
  for (int qi = 0; qi < Q; qi++) {
    scanf("%lld", &N);
    if (N < 10) {
      printf("%d\n", cheats[(int)N]);
      continue;
    }
    long long int low = 3, high = N / 2, med, v;
    while (low != high) {
      med = (high + low + 1) / 2;
      v = med * (med - 1) / 2;
      if (v <= (N - med))
        low = med;
      else
        high = med - 1;
    }
    high = low * (low - 1) / 2;
    if (N - low >= high + 3)
      printf("%lld\n", 2 * (N - low - 1));
    else
      printf("%lld\n", high + N - low);
  }
  return 0;
}
