/* >>>>>Shwetal<<<<< */
#include <bits/stdc++.h>
#define int long long
#define f(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inputArray(arr) f(i, 0, arr.size()) cin >> arr[i]
#define printArray(arr) f(i, 0, arr.size()) cout << arr[i] << ' '; cout << endl
#define endl '\n'
typedef long long ll;
const int mod = 1e9+7;
using namespace std;

void solve() {
    int n;
    cin >> n;
    int l = 1;
    int r = n/2;
    int ans = 0;
    while(l <= r){
        int m  = l + (r - l)/2;
        int a = 2*m + 1;
        int b = (a*a - 1)/2;
        int c = a*a - b;
        if(c <= n){
            ans = m;
            l = m+1;
        }else{
            r = m - 1;
        }
    }
    cout << ans << endl;
}

int32_t main(){
    // freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int T = 1;
    cin >> T;
    while(T--){
        solve();
        // if(solve())
            // cout << "YES" << endl;
        // else
            // cout << "NO" << endl;
    }
    return 0;
}