#include <bits/stdc++.h>
using namespace std;
const long long mx = 10000000;
const long long mod = 1e9 + 7;
void solve() {
  int t;
  std ::cin >> t;
  while (t--) {
    int n;
    std ::cin >> n;
    int mn = INT_MAX;
    for (int i = 1; i * i <= n; i++) {
      mn = min(mn, ((n + (i - 1)) / i) + (i - 2));
    }
    std ::cout << mn;
    cout << "\n";
  }
}
int main() {
  solve();
  return 0;
}
