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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class test2{

    public static int getInt(BufferedReader br) throws IOException {
        return Integer.parseInt(br.readLine());
    }

    public static long getLong(BufferedReader br) throws IOException {
        return Long.parseLong(br.readLine());
    }

    public static String getString(BufferedReader br) throws IOException {
        return br.readLine();
    }

    public static int[] getIntArray(BufferedReader br) throws IOException {
        String[] arr = (br.readLine()).split(" ");
        int[] ans = new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            ans[i] = Integer.parseInt(arr[i]);
        }
        return ans;
    }

    public static long[] getLongArray(BufferedReader br) throws IOException {
        String[] arr = (br.readLine()).split(" ");
        long[] ans = new long[arr.length];
        for (int i = 0; i < arr.length; i++) {
            ans[i] = Long.parseLong(arr[i]);
        }
        return ans;
    }

    public static char[] getCharArray(BufferedReader br) throws IOException {
        String s = br.readLine();
        char[] ch = new char[s.length()];
        for (int i = 0; i < s.length(); i++) {
            ch[i] = s.charAt(i);
        }
        return ch;
    }

    public static void out(String s) {
        System.out.println(s);
    }
    public static int lower(ArrayList<Long> arr,long key){
        int low = 0;
        int high = arr.size()-1;
        while(low < high){
            int mid = low + (high - low)/2;
            if(arr.get(mid) >= key){
                high = mid;
            }
            else{
                low = mid+1;
            }
        }
        return low;
    }
    public static int upper(ArrayList<Long> arr,long key){
        int low = 0;
        int high = arr.size()-1;
        while(low < high){
            int mid = low + (high - low)/2;
            if(key >= arr.get(mid)){
                low = mid+1;
            }
            else{
                high = mid;
            }
        }
        return low;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        long n=1000000000;
        long a=3;
        ArrayList<Long> arr=new ArrayList<>();
        while(true){
            long sq=a*a;
            long b=(sq - 1)/2;
            long c=(sq-b);

            if (a < b && b < c && (c*c)==(sq+(b*b))) {
                //System.out.println("here");
                arr.add(c);
            }
            if(b>n){
                break;
            }
            a=a+2;
        }
        Collections.sort(arr);
        //arr.forEach(System.out::println);
        int t = getInt(br);
        while (t > 0) {
            t--;
            n=getLong(br);
//            if(n==1000000000){
//                System.out.println("22360");
//                continue;
//            }
            System.out.println(upper(arr,n));
        }
        br.close();
    }
}