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 <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long INF = 1e18;
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;
const double inf = 2 * INF;
const long long N = 0;
vector<long long> tmp, v;
long long pw(long long a, long long p) {
  long long result = 1;
  while (p > 0) {
    if (p & 1) result = a * result;
    a = a * a;
    p >>= 1;
  }
  return result;
}
long long sq(long long x) {
  long long ans = sqrt(x);
  while (ans * ans < x) {
    ans++;
  }
  while (ans * ans > x) {
    ans--;
  }
  return ans;
}
void precompute() {
  for (long long i = 3; i < 61; i++) {
    for (long long j = 2; j < INF; j++) {
      if (pow(j, i) >= inf) {
        break;
      }
      tmp.push_back(pw(j, i));
    }
  }
  sort((tmp).begin(), (tmp).end());
  (tmp).erase(unique((tmp).begin(), (tmp).end()), (tmp).end());
  for (long long x : tmp) {
    long long t = sq(x);
    if (t * t == x) {
      continue;
    }
    v.push_back(x);
  }
}
void solve() {
  long long n;
  cin >> n;
  long long ans = upper_bound((v).begin(), (v).end(), n) - v.begin();
  long long x = sq(n) - 1;
  ans += x;
  ans = n - 1 - ans;
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  precompute();
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
