#include <bits/stdc++.h>
using namespace std;
int Q;
long long int N;
int cheats[50] = {0,  0,  1,  2,  3,  4,  6,  7,  8,  10, 12, 13,
                  14, 16, 18, 20, 21, 22, 24, 26, 28, 30, 31};
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 =
                      (long long int)(sqrt((double)2.0 * N + (double)1 / 4.0) -
                                      (double)0.5),
                  high;
    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;
}
