#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int a;
    scanf("%d", &a);
    if (a == 1) {
      printf("0\n");
      continue;
    }
    int sq = sqrt(a);
    int sum = sq - 1;
    if (a % sq == 0) {
      sum += (a / sq - 1);
    } else
      sum += (a / sq);
    printf("%d\n", sum);
  }
  return 0;
}
