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