#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3fffffff;
const int maxn = 1e5 + 5;
const long long p = 1e9 + 7;
long long qsm(long long a, long long b) {
  long long base = a, ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = ans * base % p;
    base = base * base % p;
    b >>= 1;
  }
  return ans;
}
long long n, k;
struct jz {
  int a1, a2, b1, b2;
} e[1005];
void solve() {
  int n;
  cin >> n;
  int l = max((int)sqrt(n) - 10, 0);
  int r = min((int)sqrt(n), n - 1);
  int res = 1e9;
  for (int i = l; i <= r; i++) {
    res = min(res, i + (n - 1) / (1 + i));
  }
  cout << res << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
