#include <bits/stdc++.h>
using namespace std;
int rec() {}
int main() {
  int t;
  cin >> t;
  vector<int> vec;
  vec.push_back(0);
  vec.push_back(0);
  vec.push_back(1);
  vec.push_back(2);
  while (t--) {
    int n;
    cin >> n;
    int sn = floor(sqrt(n));
    if (sn * sn >= n) {
      cout << 2 * sn - 2 << "\n";
    } else if (sn * (sn + 1) >= n) {
      cout << 2 * sn - 1 << "\n";
    } else {
      cout << 2 * sn << "\n";
    }
  }
  return 0;
}
