#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
const double eps = 1e-8;
int t, n;
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    if (n == 1)
      puts("0");
    else if (n == 2)
      puts("1");
    else {
      int cnr = ceil(sqrt(n));
      int cnt = (cnr - 1) * 2;
      int a = cnr * cnr - n;
      cout << cnt - a / cnr << endl;
    }
  }
  return 0;
}
