#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#include <numeric>
#include <functional>
#include <chrono>
#include <cassert>
#include <bitset>
using ll = long long;
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;


void test_case()
{
    int n;
    scanf("%d", &n);
    n *= 2;
    n--;
    n = sqrt(n) - 1;
    n /= 2;
    printf("%d\n", n);
}

int main()
{
    int tc;
    scanf("%d", &tc);
    while (tc--)
        test_case();

    return 0;
}