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.
/*
javac nuf.java && java nuf
*/

import java.io.*;
import java.util.*;

public class nuf {
	public static void main(String[] args) { new nuf(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	int t;
	int ptr, MAX;
	int[] mu, pr;
	boolean[] comp;
	long last = -1;
	boolean first = true;
	long N = (long)1e18 + 1;
	long[] n, rt;


	nuf() {
		ptr = 0; MAX = 61;
		pr = new int[MAX];
		mu = new int[MAX];
		comp = new boolean[MAX];

		int z;
		mu[1] = 1;
		for (int i = 2; i < MAX; i++) {
			if (!comp[i]) {
				pr[ptr++] = i;
				mu[i] = -1;
			}
			for (int j = 0; j < ptr && i * pr[j] < MAX; j++) {
				z = i * pr[j];
				comp[z] = true;
				if (i % pr[j] == 0) {
					mu[z] = 0;
					break;
				}
				else mu[z] = mu[i] * mu[pr[j]];
			}
		}

		t = in.nextInt();
		n = new long[t];
		for (int i = 0; i < t; i++)
			n[i] = in.nextLong();
		Integer[] ord = new Integer[t];
		for (int i = 0; i < t; i++) ord[i] = i;
		Arrays.sort(ord, (x, y) -> -Long.compare(n[x], n[y]));
		
		rt = new long[MAX];
		Arrays.fill(rt, (long) 1e6);
		rt[1] = N - 1;
		rt[2] = (long) 1e9;
		for (int i = 3; i < MAX; i++) rt[i] = (long) 1e6;
		for (int i = 6; i < MAX; i++) rt[i] = (long) 1e3;
		for (int i = 9; i < MAX; i++) rt[i] = (long) 1e2;
		for (int i = 18; i < MAX; i++) rt[i] = (long) 1e1;

		int v; last = -1;
		long[] ans = new long[t];
		for (int ii = 0; ii < t; ii++) {
			v = ord[ii];

			upd(n[v]);
			for (int j = 1; j < MAX; j++) {
				if (mu[j] == 0) continue;
				ans[v] += mu[j] * (rt[j] - 1);
			}
		}
		for (int i = 0; i < t; i++)
			out.println(ans[i]);
		out.close();
	}

	void upd(long x) {
		if (x == last) return;
		last = x;
		rt[1] = x;
		rt[2] = kthRoot(x, 2);
		long z;
		for (int i = 3; i < MAX; i++)
			if (mu[i] != 0) {
				z = pow(rt[i], i);
				while (z == -1 || z > x) {
					rt[i]--;
					z = pow(rt[i], i);
				}
			}
	}
	long kthRoot(long x, long y) {
		long z = 0, nz, pp;
		for (long lg = MAX - 1; lg >= 0; lg--) {
			nz = z | (1L << lg);
			pp = pow(nz, y);
			if (pp != -1 && pp <= x) 
				z = nz;
		}
		return z;
	}
	long pow(long x, long y) {
		long z = 1L;
		while (y > 0) {
			if (x == -1) return -1;
			if ((y & 1) == 1) z = mult(z, x);
			x = mult(x, x); 
			y >>= 1;
		}
		return z;
	}
	long mult(long x, long y) {
		if (x < 0 || y < 0) throw null;
		if (x >= N || y >= N) return -1;
		long pd = x * y;
		if (pd / x != y) return -1;
		if (pd >= N) return -1;
		return pd;
	}
	
	int abs(int x) { return x < 0 ? -x : x; }
	long abs(long x) { return x < 0 ? -x : x; }
	double abs(double x) { return x < 0 ? -x : x; }
	int min(int x, int y) { return x < y ? x : y; }	
	int max(int x, int y) { return x > y ? x : y; }
	long min(long x, long y) { return x < y ? x : y; }	
	long max(long x, long y) { return x > y ? x : y; }
	double min(double x, double y) { return x < y ? x : y; }
	double max(double x, double y) { return x > y ? x : y; }
	int gcd(int x, int y) { while (y > 0) { x = y^(x^(y = x)); y %= x; } return x; }
	long gcd(long x, long y) { while (y > 0) { x = y^(x^(y = x)); y %= x; } return x; }
	long lcm(int x, int y) { return ((long) x / gcd(x, y)) * y; }
	long lcm(long x, long y) { return (x / gcd(x, y)) * y; }

	void sort(int[] arr) {
		int sz = arr.length, j;
		Random r = new Random();
		for (int i = 0; i < sz; i++) {
			j = r.nextInt(i + 1);
			arr[i] = arr[j]^(arr[i]^(arr[j] = arr[i]));
		} Arrays.sort(arr);
	}

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}

