#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int M = 1e5 + 7;
long long n;
bool cal(long long x, long long c) {
  if (-x * x + c * x + c + 1 >= n) return 1;
  return 0;
}
bool ck(long long c) {
  long long x = c / 2;
  long long nm = n;
  if (cal(x, c) || cal(x - 1, c) || cal(x + 1, c)) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    if (n == 1) {
      cout << 0 << endl;
      continue;
    }
    long long l = 1, r = 1e9, ans = 0;
    while (l <= r) {
      long long m = (l + r) / 2;
      if (ck(m))
        ans = m, r = m - 1;
      else
        l = m + 1;
    }
    cout << ans << endl;
  }
  return 0;
}
