#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n, x, y;
    cin >> n;
    int a = sqrt(n);
    if (a * a == n) {
      cout << (a - 1) + (a - 1) << endl;
    } else {
      x = sqrt(n) + 1;
      if (n % x == 0) {
        y = n / x;
      } else {
        y = n / x + 1;
      }
      cout << (x - 1) + (y - 1) << endl;
    }
  }
  return 0;
}
