#include <bits/stdc++.h>
using namespace std;
int helper(long long int edges, long long int nodes) {
  if (edges == nodes - 1) return nodes - 1;
  edges -= nodes - 1;
  return nodes - 1 - ceil((1.0 + sqrt(1.0 + 8.0 * edges)) / 2.0);
}
int main() {
  ios::sync_with_stdio(false);
  ;
  cin.tie(0);
  ;
  long long int i, j, q, n, lo, mid, hi;
  cin >> q;
  while (q--) {
    cin >> n;
    lo = n - 1;
    hi = (n * (n - 1)) / 2 + 1;
    while (hi - lo > 1) {
      mid = (lo + hi) / 2;
      if (helper(mid, n) >= (mid + 1) / 2)
        lo = mid;
      else
        hi = mid;
    }
    cout << lo << "\n";
  }
  return 0;
}
