#include <bits/stdc++.h>
using namespace std;
class node {
 public:
  int key;
  node* nextnode;

 public:
  void getdata() {
    char c;
    cout << "Enter value of node " << endl;
    cin >> key;
    cout << "Want to add more ?? " << endl;
    cin >> c;
    if (c != 'y' && c != 'Y') {
      nextnode = NULL;
      return;
    }
    nextnode = new node;
    nextnode->getdata();
  }

 public:
};
void solution() {
  long long int m;
  cin >> m;
  if (m == 1) {
    cout << 0 << endl;
    return;
  }
  long long int p = sqrt(m);
  double t = sqrt(m);
  if (t - p == 0) {
    cout << 2 * p - 2 << endl;
    return;
  }
  if (t - p >= 0.5) {
    cout << 2 * p << endl;
    return;
  } else {
    cout << 2 * p - 1 << endl;
    return;
  }
}
int main() {
  long long int t = 1;
  cin >> t;
  while (t--) {
    solution();
  }
}
