#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, i;
  cin >> n;
  while (i * i <= n) i++;
  if ((i - 1) * (i - 1) == n) {
    cout << 2 * i - 4 << endl;
    return;
  } else {
    cout << ceil(((float)(n - i) / i)) + (i - 1) << endl;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
