#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long fastPow(long long base, long long exp, long long mod) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = ((res % mod) * (base % mod)) % mod;
    base = ((base % mod) * (base % mod)) % mod;
    exp /= 2;
  }
  return res % mod;
}
void solve() {
  long long n;
  cin >> n;
  long long x = sqrt(n);
  long long ans = n / x + (bool)(n % x) + x - 2;
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tc = 1;
  cin >> tc;
  while (tc--) {
    solve();
  }
  return 0;
}
