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.
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
int ddx[] = {2, 2, -2, -2, 1, 1, -1, -1}, ddy[] = {1, -1, 1, -1, 2, -2, 2, -2};
int moe[101];
long long ppow(long long a, int i) {
  if (i == 0) return 1;
  if (i == 1) return a;
  long long t = ppow(a, i / 2);
  if (t > 1000000000000000000 / t) return 1000000000000000000 + 1;
  t *= t;
  if (i & 1) {
    if (t > 1000000000000000000 / a) return 1000000000000000000 + 1;
    t *= a;
  }
  return t;
}
int main() {
  moe[1] = 1;
  for (int i = 1; i <= 100; i++) {
    for (int j = 2 * i; j <= 100; j += i) {
      moe[j] -= moe[i];
    }
  }
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    long long n;
    scanf("%lld", &n);
    long long ans = 0;
    for (int(i) = (2); (i) <= (60); (i) += (1)) {
      double t = log(n) / i;
      long long x = (long long)(exp(t));
      long long y = 0;
      for (long long tt = max(1LL, x - 1); tt <= x + 1; tt++) {
        if (ppow(tt, i) <= n) y = tt;
      }
      ans -= moe[i] * y;
    }
    printf("%lld\n", n - ans + 1);
  }
}
