#include <bits/stdc++.h>
using namespace std;
int const N = 1000005;
long double pi = 3.14159265359;
long long const mod = 1000000007;
void FAST() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void TXT() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  FAST();
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n == 1) {
      cout << "0\n";
      continue;
    }
    int ans = 1e9;
    for (int i = 2; i <= 100000; i++) {
      ans = min(i - 2 + (n + i - 1) / i, ans);
    }
    cout << ans << "\n";
  }
}
