Problem: A Pythagorean triple is a triple of integer numbers (a, b, c) such that it is possible to form a right triangle with the lengths of the first cathetus, the second cathetus and the hypotenuse equal to a, b and c, respectively. An example of the Pythagorean triple is (3, 4, 5).

Vasya studies the properties of right triangles, and he uses a formula that determines if some triple of integers is Pythagorean. Unfortunately, he has forgotten the exact formula; he remembers only that the formula was some equation with squares. So, he came up with the following formula: c = a^2 - b.

Obviously, this is not the right formula to check if a triple of numbers is Pythagorean. But, to Vasya's surprise, it actually worked on the triple (3, 4, 5): 5 = 3^2 - 4, so, according to Vasya's formula, it is a Pythagorean triple.

When Vasya found the right formula (and understood that his formula is wrong), he wondered: how many are there triples of integers (a, b, c) with 1 ≤ a ≤ b ≤ c ≤ n such that they are Pythagorean both according to his formula and the real definition? He asked you to count these triples.

Input

The first line contains one integer t (1 ≤ t ≤ 10^4) — the number of test cases.

Each test case consists of one line containing one integer n (1 ≤ n ≤ 10^9).

Output

For each test case, print one integer — the number of triples of integers (a, b, c) with 1 ≤ a ≤ b ≤ c ≤ n such that they are Pythagorean according both to the real definition and to the formula Vasya came up with.

Example

Input


3
3
6
9


Output


0
1
1

Note

The only Pythagorean triple satisfying c = a^2 - b with 1 ≤ a ≤ b ≤ c ≤ 9 is (3, 4, 5); that's why the answer for n = 3 is 0, and the answer for n = 6 (and for n = 9) is 1.

Solution (in CPP):

Solution:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
#include<bits/stdc++.h>
#define debug(x) cout<<#x<<" :"<<x<<endl
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define eps 1e-6
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1e4+7;
ll powmod(ll a,ll b,ll mod1) {ll res=1;a%=mod1; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod1;a=a*a%mod1;}return res;}
const int maxn=1e6+10;
const int MAXN=2e5+10;
ll q[maxn];
ll n,m;
ll qpow(ll a,ll b){
    ll ans=1;
    while(b){
        if(b&1)ans=ans*a;
        a=a*a;
        b>>=1;
    }
    return ans;
}

/*
二分答案

*/
ll d[maxn],s[maxn],tt[maxn];
ll kep[maxn];

ll cf[maxn];
int check(ll mid){
    ll sum=mid;
    ll mx=0;
    for(int i=1;i<=n;++i)mx=max(mx,q[i]);
    if(sum>=mx)return 1;
    for(int i=1;i<=n;++i){
        if(q[i]>sum){
            sum-=(q[i]-sum);
           
        }
        else{
            sum+=(sum-q[i]);
        }

        if(sum<0)return 0;
        if(sum>=mx)return 1;
    }
    return 1;
}
int main(){
    int t;
    srand(time(NULL));
    cin>>t;
    q[1]=5;
    for(ll i=2;i<=1e5;++i){
        q[i]=q[i-1]+4*i;
    }
    while(t--){
        cin>>n;
        int ans=0;
        /*rep(i,1,n){
            rep(j,1,n){
                rep(h,1,n){
                    if(h==i*i-j&&h*h==i*i+j*j&&i<=j&&j<=h){
                        //cout<<i<<" "<<j<<" "<<h<<endl;
                        ans++;
                    }
                }
            }
        }
        cout<<ans<<"\n";
        */
        ll val=n;
        ll pos=upper_bound(q+1,q+1+100000,val)-q;
        cout<<pos-1<<"\n";  
    }
    return 0;
}
/*
5 13 25 41 61
 */