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.util.*;
	import java.lang.*;
	import java.io.*;
	import java.math.*;

	public class practice{
		public static void main(String[] args){
			FastScanner inp = new FastScanner();
			int t = inp.nextInt(),n,sum,c,m;
			StringBuffer ans = new StringBuffer("");
			boolean[] visited ;
			while(t-->0) {
				n = inp.nextInt();
				sum=0;
				m=2;
				c=0;
				while (c < n) {  
	                c = m * m + (m-1) * (m-1); 
	                if (c > n) 
	                    break; 
	                 sum++; 
	             
	            m++; 
	        }
				
				ans.append(sum + "\n");
			}	
			System.out.println(ans);
					
		}
		
		 
		static int gcd(int a, int b)
		{ 
		    if (a == 0)
		       return b*b;
		    if (b == 0)
		       return a*a;
		  
		 
		    if (a == b)
		        return a*a;
		  
		 
		    if (a > b)
		        return gcd(a-b, b);
		    return gcd(a, b-a);
		}
		
		static int lcm(int a, int b) {
			return (a*b)/gcd(a,b);
		}

		
		static boolean  isPrime(int n) {
			if(n <=1 )return false;
			if(n==2) return true;
			if(n%2==0) return false;
			for(int i=3;i<=Math.sqrt(n);i+=2)
				if(n%i==0) return false;
			return true;
		}
		static void incrementCount(HashMap<Integer,Integer> map, int key) {
			if(map.containsKey(key))
				map.put(key, map.get(key) +1);
			else
				map.put(key, 1);
		}
		
		private static int countDigits(int l) {
				if (l >= 1000000000) return 10;
				if (l >= 100000000) return 9;
				if (l >= 10000000) return 8;
				if (l >= 1000000) return 7;
				if (l >= 100000) return 6;
				if (l >= 10000) return 5;
				if (l >= 1000) return 4;
				if (l >= 100) return 3;
				if (l >= 10) return 2;
				return 1;
			}
		private static int countDigits(long l) {
				if (l >= 1000000000000000000L) return 19;
				if (l >= 100000000000000000L) return 18;
				if (l >= 10000000000000000L) return 17;
				if (l >= 1000000000000000L) return 16;
				if (l >= 100000000000000L) return 15;
				if (l >= 10000000000000L) return 14;
				if (l >= 1000000000000L) return 13;
				if (l >= 100000000000L) return 12;
				if (l >= 10000000000L) return 11;
				if (l >= 1000000000L) return 10;
				if (l >= 100000000L) return 9;
				if (l >= 10000000L) return 8;
				if (l >= 1000000L) return 7;
				if (l >= 100000L) return 6;
				if (l >= 10000L) return 5;
				if (l >= 1000L) return 4;
				if (l >= 100L) return 3;
				if (l >= 10L) return 2;
				return 1;
			}

	}
		

	class FastScanner {
	    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    StringTokenizer st=new StringTokenizer("");
	    String next() {
	        while (!st.hasMoreTokens())
	            try {
	                st=new StringTokenizer(br.readLine());
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	        return st.nextToken();
	    }
	    int[] intArr(int n) {
	    	int[] arr = new int[n];
	    	for(int i=0;i<n;i++)
	    		arr[i] = nextInt();
	    	return arr;
	    }
	    String[] StringArr(int n) {
	    	String[] arr = new String[n];
	    	for(int i=0;i<n;i++)
	    		arr[i] = next();
	    	return arr;
	    }
	    long[] longArr(int n) {
	    	long[] arr = new long[n];
	    	for(int i=0;i<n;i++)
	    		arr[i] = nextLong();
	    	return arr;
	    }
	    String nextLine()
	    {
	        String str = "";
	        try
	        {
	            str = br.readLine();
	        }
	        catch (IOException e)
	        {
	            e.printStackTrace();
	        }
	        return str;
	    }

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	}