#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    int cut = 1;
    int ans1 = 0;
    int ans2 = 1000010000;
    if (n == 1) {
    }
    while (cut <= 100000) {
      ans1 = cut + (n + cut - 1) / cut - 2;
      if (ans1 > ans2) {
        break;
      }
      ans2 = ans1;
      cut++;
    }
    printf("%d\n", ans2);
  }
  return 0;
}
