#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, t, n;
  double x, y;
  cin >> t;
  while (t--) {
    cin >> n;
    switch (n) {
      case 1:
        j = 0;
        break;
      case 2:
        j = 1;
        break;
      case 3:
        j = 2;
        break;
      default:
        x = double(n);
        y = sqrt(x);
        i = int(y);
        if (n == (i * i)) {
          j = (i - 1) + (i - 1);
        } else {
          n = n - (i * i);
          if ((n % i) == 0) {
            j = (i - 1) + (n / i) + (i - 1);
          } else {
            j = i + (n / i) + (i - 1);
          }
        }
    }
    cout << j << endl;
  }
}
