#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
long long n, q;
int main() {
  while (cin >> q) {
    while (q--) {
      cin >> n;
      long long ans = n - 1;
      long long l = (n - 1) / 2, r = n - 1;
      if (n % 2 == 0) l++;
      if (n % 2 == 0 && n > 4) ans = n;
      while (l <= r) {
        long long mid = (l + r) >> 1;
        long long mmid = (mid + r) >> 1;
        long long val1 = mid + min(mid, (n - mid) * (n - mid - 1) / 2);
        long long val2 = mmid + min(mmid, (n - mmid) * (n - mmid - 1) / 2);
        if (val1 > val2) {
          ans = max(ans, val1);
          r = mmid - 1;
        } else {
          ans = max(val2, ans);
          l = mid + 1;
        }
      }
      cout << ans << endl;
    }
  }
  return 0;
}
