#include <bits/stdc++.h>
using namespace std;
long long podeli(long long a, long long b) {
  if (a % b == 0) return a / b;
  return a / b + 1;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  long long t;
  cin >> t;
  for (long long e = 0; e < t; ++e) {
    long long n;
    cin >> n;
    long long x = 1;
    long long d = sqrt(n), sol = n - 1;
    for (long long i = max(0ll, d - 20); i <= d + 20; ++i) {
      long long a = i;
      long long b = podeli(n, a + 1) - 1;
      sol = min(sol, a + b);
    }
    cout << sol << '\n';
  }
}
