#include <bits/stdc++.h>
using namespace std;
bool comp(pair<long long int, long long int> &a,
          pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
unsigned long long int Zeros(unsigned long int n) {
  unsigned long long int i, count = 0;
  for (i = 5; n / i >= 1; i *= 5) count += n / i;
  return count;
}
long long int power(long long int n, long long int p) {
  if (p == 0)
    return 1;
  else {
    long long int ans = power(n, p / 2) % 1000000007;
    ans = (ans * ans) % 1000000007;
    if (p % 2 == 0)
      return ans;
    else
      return ans = (ans * n) % 1000000007;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t;
  cin >> t;
  while (t--) {
    long long int i, j, n, a, b, c, c1, d, m,
        sum = 0, temp, k, k2, k1, ans = 1000000007, cnt = 0, r = 0, e, f, y;
    string stri, om;
    map<char, long long int> make_pair, mp1;
    set<long long int> st;
    priority_queue<long long int> pq;
    vector<pair<long long int, long long int> > v, v1;
    cin >> n;
    for (i = 1; i <= sqrt(n); i++) {
      k = (n + i - 1) / i;
      ans = min(ans, k + i - 2);
    }
    cout << ans << endl;
  }
  return 0;
}
