#include <bits/stdc++.h>
using namespace std;
int main() {
  double n;
  double i;
  double j;
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    double min = 1e9;
    for (i = 1; i <= int(sqrt(n)); i++) {
      j = (n / i);
      double k = ceil(j);
      if (i + k - 2 < min) min = i + k - 2;
    }
    cout << min << "\n";
  }
  return 0;
}
