#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long power(long long a, long long n, long long p = mod) {
  if (n < 0) return 0;
  long long ans = 1;
  while (n) {
    if (n & 1) ans = (ans * a) % p;
    a = (a * a) % p;
    n >>= 1;
  }
  return ans;
}
long long inverse(long long x, long long p = mod) { return power(x, p - 2); }
void pre(void) {}
void solve(void) {
  long long n;
  cin >> n;
  long long ans = 0;
  long long curr = 0;
  long long sum = 1;
  if (n == 1) {
    cout << 0 << '\n';
    return;
  }
  set<long long> s;
  s.insert(1);
  ans = INT_MAX;
  for (long long i = 1e5; i >= 1; i--) {
    long long temp = 0;
    long long x = n;
    temp = ceil(n / (long double)i);
    ans = min(ans, temp + i);
  }
  cout << ans - 2 << '\n';
}
int32_t main(void) {
  std::ios::sync_with_stdio(0);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  pre();
  long long t = 1;
  cin >> t;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
