#include <stdio.h>
#include <math.h>
#include<bits/stdc++.h>
using namespace std;


// C = a^2 - b and C^2 = a^2 + b^2 hence (a^2 - b)^2 = a^2 + b^2 , evaluate and subtract then, a^2 = 2*b+1
// Since a^2 - b = C , then 2*b+1 - b = C , then C = b+1 !!!!! , We can observe that the difference between b and c are just 1
// b and c are nearly equal , so we must find integer "a" so that its square is odd number since odd / 2 gives you two numbers
// the floor and the ceil , which are basically b and b+1 -> b and c ^^

int main() {


    int t;

    scanf("%d",&t);

    while(t--) {

        int n;

        scanf("%d",&n);

        int odd_Square = sqrt(n << 1); // --> sqrt ( n / 2 );

        printf("%d\n",(odd_Square-1) >> 1); // --> (odd_Square - 1) / 2 ;

    }

    return 0;

}
