#include <bits/stdc++.h>

#define ft first
#define sd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vb = vector<bool>;
using vvi = vector<vi>;


int t;
ll n, k;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> t;
    while (t--) {
        cin >> n;
        ll ans = 0;
        if (n < 5) {
            cout << 0 << '\n';
            continue;
        }
        for (int i = 3; i * i < 2 * n; i += 2) {
            if ((i * i - 1) / 2 + 1 <= n) ans++;
        }

        cout << ans << '\n';
    }
}
