#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int n;
  while (t--) {
    scanf("%d", &n);
    int k = sqrt(n);
    if (n == 1)
      cout << 0 << endl;
    else if (k * k == n) {
      cout << 2 * k - 2 << endl;
    } else
      cout << k - 1 + (n + k - 1) / k - 1 << endl;
  }
  return 0;
}
