#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> arr;
    arr.push_back(1);
    if (n <= 1) {
      cout << 0 << "\n";
      continue;
    }
    int sum = 1;
    int count = 0;
    int ans = INT_MAX;
    int i = 1;
    while (i <= sqrt(n)) {
      int a = (i - 1) + (n / i);
      if (n % i == 0) a--;
      i++;
      ans = min(a, ans);
    }
    cout << ans << "\n";
    continue;
  }
  return 0;
}
