#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
ll int gcd(ll int a,ll int b){if(!b)return a;return gcd(b, a % b);}
ll int lcm(ll int a,ll int b){ return (a*b)/gcd(a,b);}
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }



  int main(){
    IOS;
  ll int tt;  cin>>tt; while(tt--){
   ll int n,cnt=0;
   cin>>n;
    if(n<=4) {printf("0\n"); continue;}
   for(int i=3;i<=1000000000;i+=2){
      if((((i*i)-1)/2)+1<=n) cnt++;
      else break;
    //  printf("%lld ",s);
      
   }
   printf("%lld\n",cnt);
 }
 }