Consider some positive integer x. Its prime factorization will be of form x = 2^{k_1} ⋅ 3^{k_2} ⋅ 5^{k_3} ⋅ ...

Let's call x elegant if the greatest common divisor of the sequence k_1, k_2, ... is equal to 1. For example, numbers 5 = 5^1, 12 = 2^2 ⋅ 3, 72 = 2^3 ⋅ 3^2 are elegant and numbers 8 = 2^3 (GCD = 3), 2500 = 2^2 ⋅ 5^4 (GCD = 2) are not.

Count the number of elegant integers from 2 to n.

Each testcase contains several values of n, for each of them you are required to solve the problem separately.

Input

The first line contains a single integer T (1 ≤ T ≤ 10^5) — the number of values of n in the testcase.

Each of the next T lines contains a single integer n_i (2 ≤ n_i ≤ 10^{18}).

Output

Print T lines — the i-th line should contain the number of elegant numbers from 2 to n_i.

Example

Input

4
4
2
72
10


Output

2
1
61
6

Note

Here is the list of non-elegant numbers up to 10:

  * 4 = 2^2, GCD = 2; 
  * 8 = 2^3, GCD = 3; 
  * 9 = 3^2, GCD = 2. 



The rest have GCD = 1.
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class A {
	public static void main (String[] args) { new A(); }

	A() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("");

		int Q = fs.nextInt();
		Query[] qs = new Query[Q];
		for(int i = 0; i < Q; i++) qs[i] = new Query(i, fs.nextLong());
		Arrays.sort(qs);
		
		long[][] kRoot = new long[61][Q];
		
		for(int k = 2; k <= 60; k++) {
			if(k >= 10) {
				Arrays.fill(kRoot[k], 64);
				for(int i = Q-1; i >= 0; i--) {
					if(i+1 < Q) kRoot[k][i] = kRoot[k][i+1];
					while(invalid(kRoot[k][i], qs[i].N, k)) kRoot[k][i]--; 
				}
			}
			else {
				for(int i = Q-1; i >= 0; i--) {
					long lo = 1, hi = (long)2e9;
					if(i+1 < Q) hi = kRoot[k][i+1];
					for(int bs = 0; bs < 50 && lo <= hi; bs++) {
						long mid = (lo+hi)/2;
						if(invalid(mid, qs[i].N, k)) {
							hi = mid-1;
						}
						else {
							kRoot[k][i] = mid;
							lo = mid+1;
						}
						
					}
				}
			}
		}
		
		int MAX = (int)1e2+10, ptr = 0;
		boolean[] isComposite = new boolean[MAX];
		int[] primes = new int[MAX];
		int[] mobius = new int[MAX];
		mobius[1] = 1;
		
		for(int i = 2; i < MAX; i++) {
			if(!isComposite[i]) {
				primes[ptr++] = i;
				mobius[i] = -1; 
			}
			for(int j = 0; j < ptr && i*primes[j] < MAX; j++) {
				int val = i * primes[j];
				isComposite[val] = true;
				if(i % primes[j] == 0) {
					mobius[val] = 0;
					break;
				}
				else {
					mobius[val] = mobius[i] * mobius[primes[j]];
				}
			}
		}
		
		long[] ans = new long[Q];
		for(int i = 0; i < Q; i++) {
			long res = qs[i].N-1;
			for(int root = 2; root <= 60; root++) {
				res += mobius[root] * (kRoot[root][i]-1);
			}
			ans[qs[i].id] = res;
		}
		for(long ll : ans) out.println(ll);

		out.close();
	}
	
	long MAX = (long)2e18;
	boolean invalid(long root, long N, int k) {
		if(root == 0) return false;
		long res = pow(root, k);
		if(res == -1) return true;
		return res > N;
	}
	
	long pow(long base, int pow) {
		if(pow == 0) return 1;
		if(pow == 1) return base;
		if((pow & 1) == 0) {
			long ret = pow(base, pow / 2);
			if(ret == -1) return ret;
			if(ret > MAX/ret) return -1;
			return ret*ret;
		}
		long ret = pow(base, pow-1);
		if(base > MAX/ret) return -1;
		return base*ret;
	}
	
	class Query implements Comparable<Query> {
		int id;
		long N;
		Query(int a, long b) {
			N = b;
			id = a;
		}
		public int compareTo(Query q) {
			return Long.compare(N, q.N);
		}
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) {
			try {
				in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
			}
			catch (Exception e) {
				in = new BufferedInputStream(System.in, BS);
			}
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}

	}

}