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

int main()
{
    int kase;
    cin >> kase;
    while (kase--)
    {
        long long n;
        cin >> n;

        long long a=sqrt(2*n-1);
        cout << a / 2 +( a & 1)- 1;
        if(kase)
            cout << endl;
    }
    return 0;
}
