#include <bits/stdc++.h>
using namespace std;
long long n, t;
int main() {
  cin >> t;
  while (t--) {
    scanf("%lld", &n);
    if (n == 1) {
      printf("0\n");
    } else {
      double al = sqrt(n);
      long long be = int(al);
      long long min_ = 0x7f7f7f7f7f7f7f7f;
      for (long long i = be - 3; i <= be + 3; ++i) {
        if (i <= 0) continue;
        long long j = (n - 1) / i + 1;
        min_ = min(min_, i + j - 2);
      }
      printf("%lld\n", min_);
    }
  }
  return 0;
}
