#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n == 1) {
      cout << "0" << endl;
    } else if (n == 2) {
      cout << "1" << endl;
    } else {
      int m = sqrt(n);
      if (m * m == n) {
        cout << m + m - 2 << endl;
      } else {
        if (m * (m + 1) < n) {
          cout << m + m << endl;
        } else {
          cout << m + m - 1 << endl;
        }
      }
    }
  }
  return 0;
}
