#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, n, m;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    cin >> n;
    int m = sqrt(n);
    if (n % m == 0)
      cout << n / m + m - 2 << endl;
    else
      cout << n / m + m - 1 << endl;
  }
}
