#include <bits/stdc++.h>
using namespace std;
int cost(int val, int bound) { return val + (bound + val - 1) / val - 2; }
int main() {
  if (fopen("data.in", "r")) freopen("data.in", "r", stdin);
  int T;
  cin >> T;
  while (T--) {
    int N;
    cin >> N;
    int ans = N - 1;
    for (int i = 1; i < min(N, 100000); i++) ans = min(ans, cost(i, N));
    cout << ans << endl;
  }
}
