#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a = sqrt(n);
    long long int b = n / a;
    if (n % a != 0) b++;
    if (n == 1)
      cout << "0\n";
    else {
      cout << a - 1 + b - 1 << "\n";
    }
  }
  return 0;
}
