#include <bits/stdc++.h>
using namespace std;
long long T;
long long n;
int main() {
  ios::sync_with_stdio(false);
  cin >> T;
  while (T--) {
    cin >> n;
    if (n == 1)
      cout << "0" << endl;
    else
      cout << ceil(2.0 * sqrt(n)) - 2 << endl;
  }
  return 0;
}
