#include <bits/stdc++.h>
using namespace std;
long long n;
bool check(long long e) {
  long long b = ceil(e / 2.0);
  long long v = n - b;
  if (v < 0) return 0;
  if (e - b <= (v % 2 == 0 ? (v / 2) * (v - 1) : ((v - 1) / 2) * v)) return 1;
  return 0;
}
signed main() {
  long long q;
  cin >> q;
  while (q--) {
    cin >> n;
    if (n <= 5) {
      cout << n - 1 << "\n";
      continue;
    }
    long long bg = 0, nd = (n % 2 == 0 ? (n / 2) * (n - 1) : ((n - 1) / 2) * n);
    while (bg < nd) {
      long long mid = (bg + nd + 1) >> 1;
      if (check(mid))
        bg = mid;
      else
        nd = mid - 1;
    }
    cout << bg << "\n";
  }
}
