#include <bits/stdc++.h>
using namespace std;
long long int i, j;
long long int mod = 1e9 + 7;
bool sortsec(const pair<long long int, long long int> &a,
             const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
void solve() {
  long long int n, k;
  cin >> n;
  k = sqrt(n);
  if (n == 1)
    cout << 0 << endl;
  else {
    if (sqrt(n) == k)
      cout << 2 * k - 2 << endl;
    else if (sqrt(n) > k + 0.5)
      cout << 2 * k << endl;
    else
      cout << 2 * k - 1 << endl;
  }
}
int main() {
  long long int t, T;
  cin >> T;
  for (t = 0; t < T; t++) solve();
}
