#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int64_t b = 0;
  for (int i = 0; i < a; ++i) {
    cin >> b;
    int64_t res = 1000000000;
    int64_t koechto = 10000000000;
    for (int j = 1;; ++j) {
      if (j * j > b) break;
      if (j + (b + j - 1) / j < koechto) {
        res = j;
        koechto = j + (b + j - 1) / j;
      }
    }
    cout << res - 1 + (b + res - 1) / res - 1 << "\n";
  }
  return 0;
}
