#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ans = INT_MAX;
    for (long long int i = 1; i * i <= n; i++) {
      long long int x = i - 1;
      x += (n / i);
      if (n % i == 0) x--;
      ans = min(ans, x);
    }
    cout << ans << endl;
  }
}
