#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  while (a--) {
    int b;
    cin >> b;
    int result = 0;
    for (int j = 1; j <= sqrt(b); j++) {
      if (b % j == 0) {
        result = (j - 1) + ((b / j) - 1);
      } else {
        result = (j - 1) + (b / j);
      }
    }
    cout << result << "\n";
  }
}
