#include<iostream>
#include<cmath>
using namespace std;

int main(){
    long long t;
    cin>>t;
    while(t--){
        long long n;
        cin>>n;
        long long b=n-1;
        long long maxsqrt=sqrt(2*b+1)-1;
        long long ans=maxsqrt/2;
        cout<<ans<<endl;
    }
}
