#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  long long test;
  cin >> test;
  while (test--) {
    long long n;
    cin >> n;
    if (n == 1) {
      cout << 0 << endl;
      continue;
    } else if (n == 2) {
      cout << 1 << endl;
      continue;
    }
    vector<long long> candidate;
    long long root = sqrt(n);
    for (long long i = 0; i < 50; i++) {
      candidate.push_back(root + i);
    }
    long long ans = INT_MAX;
    for (long long i = 0; i < 50; i++) {
      for (long long j = 0; j < 50; j++) {
        if (candidate[i] * candidate[j] < n) continue;
        ans = min(ans, candidate[i] + candidate[j] - 2);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
