#include <bits/stdc++.h>
using namespace std;
const int N = 101;
long long n, q, mx;
bool valid(long long edges) {
  long long bridges = (edges / 2) + edges % 2, nodes = n, x = edges;
  if (bridges >= nodes) return 0;
  nodes -= bridges;
  edges -= bridges;
  if (edges > nodes * (nodes - 1) / 2) return 0;
  mx = max(mx, x);
  return 1;
}
long long bs(long long s, long long e) {
  while (s < e) {
    long long mid = s + (e - s + 1) / 2;
    if (valid(mid))
      s = mid;
    else
      e = mid - 1;
  }
  return s;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> q;
  while (q--) {
    mx = 0;
    cin >> n;
    bs(0, 1e18);
    cout << mx << endl;
  }
}
