#include <bits/stdc++.h>
using namespace std;
int n;
int64_t f(int64_t x) { return (n + x - 1) / x + x - 2; }
void solve() {
  cin >> n;
  int64_t ans = 1e18;
  int up = sqrt(n) + 10;
  for (int i = 1; i <= up; i++) ans = min(ans, f(i));
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int _;
  cin >> _;
  while (_--) solve();
  return 0;
}
