#include <bits/stdc++.h>
using namespace std;
int check(long long e, long long n) {
  if ((e + 1) / 2 >= n) return 0;
  n -= (e + 1) / 2;
  e -= (e + 1) / 2;
  return n * (n - 1) / 2 >= e;
}
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    long long int n;
    scanf("%lld", &n);
    if (n == 1) {
      cout << 0 << endl;
      continue;
    }
    long long l = 1, r = n * (n - 1) / 2;
    long long ans = 0;
    while (l <= r) {
      long long mid = (l + r) / 2;
      if (check(mid, n)) {
        ans = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    cout << ans << endl;
  }
  return 0;
}
