#include <bits/stdc++.h>
using namespace std;
unsigned long long int LCM(int arr[], int n) {
  int max_num = 0;
  for (int i = 0; i < n; i++)
    if (max_num < arr[i]) max_num = arr[i];
  unsigned long long int res = 1;
  int x = 2;
  while (x <= max_num) {
    vector<int> indexes;
    for (int j = 0; j < n; j++)
      if (arr[j] % x == 0) indexes.push_back(j);
    if (indexes.size() >= 2) {
      for (int j = 0; j < indexes.size(); j++)
        arr[indexes[j]] = arr[indexes[j]] / x;
      res = res * x;
    } else
      x++;
  }
  for (int i = 0; i < n; i++) res = res * arr[i];
  return res;
}
bool compare(string a, string b) { return a.size() < b.size(); }
int count(string s, char a) {
  long long int k = 0;
  for (long long int i = 0; i < s.length(); i++)
    if (s[i] == a) k++;
  return k;
}
void solve() {
  long long int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    long long int a = 1e9;
    for (long long int x = 1; x * x <= n; ++x) a = min(a, x - 1 + (n - 1) / x);
    cout << a << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  solve();
  return 0;
}
