#include <bits/stdc++.h>
using namespace std;
int find(long long n) {
  long long x = ceil(sqrt(n));
  while (x * (x + 1) > n) {
    x--;
  }
  return x;
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    if (n == 1) {
      cout << 0 << endl;
    } else if (n == 2) {
      cout << 1 << endl;
    } else {
      long long x = find(2 * n);
      long long ans = n - x + (x * (x - 1)) / 2;
      if (x + 1 <= n) {
        ans = max(ans, 2 * (n - x - 1));
      }
      cout << ans << endl;
    }
  }
  return 0;
}
