#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, res = INT_MAX;
  cin >> n;
  for (int i = 1; i * i <= n; i++) {
    res = min(res, (i - 1) + (n / i - 1) + (n % i != 0));
  }
  cout << res << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
