#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,A[500005],t,idx;
int main() {
    cin>>t;
    while(t--) {
        cin>>n;
        a=sqrt(2*n-1);
        cout<<(a-1)/2<<endl;
    }
}