#include <bits/stdc++.h>
using namespace std;
int isprime(int N) {
  if (N < 2 || (!(N & 1) && N != 2)) return 0;
  for (int i = 3; i * i <= N; i += 2) {
    if (!(N % i)) return 0;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, ans = LONG_LONG_MAX, temp;
    cin >> n;
    long long int x = sqrt(n) - 5;
    if (x <= 0) x = 1;
    for (long long int i = x; i <= sqrt(n) + 5; i++) {
      temp = i - 1;
      if (n % i != 0)
        temp += n / i;
      else
        temp += n / i - 1;
      ans = min(ans, temp);
    }
    cout << ans << "\n";
  }
  return 0;
}
