#include <bits/stdc++.h>
using namespace std;
int64_t check(int64_t i, int64_t bridges) {
  int64_t maxedges = (bridges + 3) + (((i + 1) * (i + 2)) / 2) - 1;
  int64_t minedges = (bridges + 3) + (i * (i + 1)) / 2;
  if ((bridges - i) >= (minedges + 1) / 2) {
    int64_t maxallow = 2 * (bridges - i);
    return min(maxallow, maxedges);
  }
  return -1;
}
int64_t solve(int64_t n) {
  int64_t bridges = n - 1, edges = n - 1;
  if (n - 3 >= (n + 1) / 2) {
    bridges = n - 3;
    edges = n;
    int64_t low = 1, high = n - 3, mid, ans;
    while (low <= high) {
      mid = (low + high) / 2;
      ans = check(mid, bridges);
      if (ans > 0) {
        edges = max(ans, edges);
        low = mid + 1;
      } else {
        high = mid - 1;
      }
    }
  }
  return edges;
}
int main() {
  int i, q;
  int64_t n;
  cin >> q;
  for (i = 0; i < q; i++) {
    cin >> n;
    cout << solve(n) << endl;
  }
  return 0;
}
