#include <bits/stdc++.h>
using namespace std;
inline bool check(long long n, long long m) {
  return m >= (n - m) * (n - m - 1) / 2;
}
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    long long n;
    scanf("%lld", &n);
    if (n == 1) {
      printf("0\n");
      continue;
    }
    long long left = 0, right = n;
    while (right - left > 1) {
      long long mid = (left + right) / 2;
      if (check(n, mid))
        right = mid;
      else
        left = mid;
    }
    long long ans =
        max(2 * (right - 1), right + (n - right) * (n - right - 1) / 2);
    printf("%lld\n", ans);
  }
  return 0;
}
