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;
int mb[60];
long long int pw(long long int a, long long int k) {
  long long int ap = a, ans = 1;
  while (1) {
    if (k & 1) {
      if (ans >= ((long long int)(1e18) + ap) / ap) {
        ans = (long long int)(1e18) + 1;
        break;
      }
      ans *= ap;
    }
    k >>= 1;
    if (k == 0) break;
    if (ap > (long long int)(1e9)) {
      ans = (long long int)(1e18) + 1;
      break;
    }
    ap = ap * ap;
  }
  return ans;
}
long long int root(long long int n, long long int m) {
  long long int n1 = 1, n2;
  if (m > 18)
    n2 = 10;
  else if (m >= 10)
    n2 = 100;
  else if (m >= 5)
    n2 = 5000;
  else if (m == 3)
    n2 = (long long int)(1e6) + 1;
  else
    n2 = (long long int)(1e9) + 1;
  while (n1 != n2) {
    long long int nm = (n1 + n2 + 1) / 2;
    if (pw(nm, m) <= n)
      n1 = nm;
    else
      n2 = nm - 1;
  }
  return n1 - 1;
}
long long int solve(long long int n) {
  long long int ans = n - 1;
  for (long long int i = 2; i < 60; i++) {
    if (mb[i] != 0) {
      ans += (long long int)mb[i] * root(n, i);
    }
  }
  return ans;
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 2; i < 60; i++) {
    int i1 = i;
    mb[i] = 1;
    for (int j = 2; j < 60; j++) {
      if (i1 % j == 0) {
        int e = 0;
        while (i1 % j == 0) i1 /= j, e++;
        if (e > 1)
          mb[i] = 0;
        else
          mb[i] = -mb[i];
      }
    }
  }
  for (int i = 0; i < t; i++) {
    long long int n;
    scanf("%lld", &n);
    printf("%lld\n", solve(n));
  }
  return 0;
}
