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 dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
const int mod = (int)1e9 + 7;
long long INF64 = 3e18;
void smxl(long long &a, long long b) {
  if (a < b) a = b;
}
void smnl(long long &a, long long b) {
  if (a > b) a = b;
}
void adsl(long long &a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
}
void misl(long long &a, long long b) {
  a -= b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}
void smx(long long &a, long long b) {
  if (a < b) a = b;
}
void smn(long long &a, long long b) {
  if (a > b) a = b;
}
void ads(long long &a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
}
void mis(long long &a, long long b) {
  a -= b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = egcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long mbinp(long long a, long long b) {
  a %= mod;
  if (b == 0) return 1;
  long long ans = mbinp(a, b / 2);
  long long tmp = (ans * ans) % mod;
  if (b % 2) return ((tmp * a) % mod);
  return ((tmp) % mod);
}
long long C(int n, int m) {
  long long ret = 1;
  for (int i = 1; i <= m; i++) {
    ret *= (n - i + 1);
    ret /= i;
  }
  return ret;
}
long long binp(long long a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      if (res < INF64 / a)
        res *= a;
      else
        return INF64;
    }
    if (b > 1) {
      if (a < INF64 / a)
        a *= a;
      else
        return INF64;
    }
    b >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> primes(100, 0);
  vector<int> mu(100, 0);
  for (int i = 2; i < 100; i++) {
    if (primes[i] == 0) {
      mu[i]++;
      for (int j = 2 * i; j < 100; j += i) {
        primes[j] = 1;
        if (mu[j] != -1) mu[j]++;
      }
      for (int z = i * i; z < 100; z += i * i) mu[z] = -1;
    }
  }
  mu[1] = 2;
  vector<pair<long long, int> > all(n);
  for (int i = 0; i < n; i++) {
    cin >> all[i].first;
    all[i].second = i;
  }
  sort(all.rbegin(), all.rend());
  vector<long long> poss(62);
  for (int i = 3; i < 62; i++)
    poss[i] = (long long)ceil(pow((long double)1e18, 1.0 / i));
  vector<long long> ans(n);
  for (int i = 0; i < n; i++) {
    long long skr = -1;
    long long low = 0;
    long long hi = 1e9 + 10;
    while (low <= hi) {
      long long mid = (low + hi) / 2;
      if (mid * mid <= all[i].first) {
        if (mid > skr) skr = mid;
        low = mid + 1;
      } else
        hi = mid - 1;
    }
    poss[1] = all[i].first;
    poss[2] = skr;
    for (int j = 3; j < 62; j++) {
      while (poss[j] > 0 && binp(poss[j], j) > all[i].first) poss[j]--;
    }
    long long out = 0;
    for (int j = 1; j < 62; j++) {
      out += (poss[j] - 1) * (mu[j] == -1 ? 0 : (mu[j] % 2 == 1 ? -1 : 1));
    }
    ans[all[i].second] = out;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << '\n';
}
