#include <bits/stdc++.h>
using namespace std;
int main() {
  long long u = 0;
  long long q;
  cin >> q;
  for (int w = 0; w < q; w++) {
    long long t, x;
    cin >> t;
    if (t == 1) {
      cout << 0 << endl;
    } else if (t == 2) {
      cout << 1 << endl;
    } else if (t <= 4) {
      cout << 2 << endl;
    } else {
      long long o = 0, l = 0, p = 0, o1 = 0, o2 = 0, o3 = 99999999, l1 = 0;
      long long n = 2;
      for (int i = 0; i * i <= t; i++) {
        p = t;
        p = (p + n - 1) / n;
        o1 = p - 1 + n - 1;
        o3 = min(o1, o3);
        n++;
      }
      cout << o3 << endl;
    }
  }
}
