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