#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    long long l = 0, r = n + 1;
    while (r - l > 1) {
      long long k = (l + r) >> 1;
      if ((long long)(n - k) * (n - k - 1) >= 2LL * k)
        l = k;
      else
        r = k;
    }
    long long ans = 2 * l;
    for (int i = l + 1;
         i < n && (long long)i + (long long)(n - i) * (n - i - 1) / 2 > ans;
         i++)
      ans = (long long)i + (long long)(n - i) * (n - i - 1) / 2;
    cout << ans << endl;
  }
  return 0;
}
