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