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;
template <class T>
void splitstr(const string &s, vector<T> &out) {
  istringstream in(s);
  out.clear();
  copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
static void redirect(int argc, const char **argv) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (argc > 1) {
    static filebuf f;
    f.open(argv[1], ios::in);
    cin.rdbuf(&f);
    if (!cin) {
      cerr << "Failed to open '" << argv[1] << "'" << endl;
      exit(1);
    }
  }
  if (argc > 2) {
    static filebuf f;
    f.open(argv[2], ios::out | ios::trunc);
    cout.rdbuf(&f);
    if (!cout) {
      cerr << "Failed to open '" << argv[2] << "'" << endl;
    }
  }
}
static long long pclamp(long long b, int e) {
  long long ans = 1;
  for (int i = 0; i < e; i++) {
    if (ans >= LLONG_MAX / b) return LLONG_MAX;
    ans *= b;
  }
  return ans;
}
template <typename T>
static constexpr T sqr(T a) {
  return a * a;
}
template <typename T, typename P>
static constexpr T power(T a, P b) {
  return b == 0 ? T(1) : (b % 2) ? power(a, b - 1) * a : sqr(power(a, b / 2));
}
int main(int argc, const char **argv) {
  redirect(argc, argv);
  int T;
  cin >> T;
  vector<long long> cap(61);
  for (int i = 2; i <= 60; i++) {
    long long lo = 1;
    long long hi = power(10LL, 18) + 1;
    while (hi - lo > 1) {
      long long mid = (lo + hi) / 2;
      if (pclamp(mid, i) > power(10LL, 18))
        hi = mid;
      else
        lo = mid;
    }
    cap[i] = hi;
  }
  for (int cas = 0; cas < T; cas++) {
    long long N;
    cin >> N;
    vector<long long> dp(61);
    long long ans = 0;
    for (int i = 60; i >= 2; i--) {
      long long lo = 1;
      long long hi = cap[i];
      while (hi - lo > 1) {
        long long mid = (lo + hi) / 2;
        if (power(mid, i) > N)
          hi = mid;
        else
          lo = mid;
      }
      dp[i] = lo - 1;
      for (int j = 2 * i; j <= 60; j += i) dp[i] -= dp[j];
      ans += dp[i];
    }
    cout << N - 1 - ans << '\n';
  }
  return 0;
}
