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 long long int inf = 1000000000;
const long long int mod = 1000000000 + 7;
inline void IO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
inline int dcmp(long double x) { return x < -1e-12 ? -1 : (x > 1e-12); }
int dx4[] = {0, 0, -1, +1};
int dy4[] = {+1, -1, 0, 0};
int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
inline void I(int& a) { scanf("%d", &a); }
inline void I(long long int& a) { scanf("%I64d", &a); }
inline void I(unsigned long long int& a) { scanf("%I64u", &a); }
inline void I(char* a) { scanf("%s", a); }
char Iarr[2000010];
inline void I(string& a) {
  scanf("%s", Iarr);
  a = Iarr;
}
template <typename T, typename... Args>
void I(T& a, Args&... args) {
  I(a);
  I(args...);
}
inline void OUT(int a) { printf("%d", a); }
inline void OUT(long long int a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); }
inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); }
inline void OUT(string a) {
  for (__typeof(a.end()) it = (a.begin()) - ((a.begin()) > (a.end()));
       it != (a.end()) - ((a.begin()) > (a.end()));
       it += 1 - 2 * ((a.begin()) > (a.end())))
    printf("%c", *it);
}
inline void OUT(unsigned long long int a) { printf("%I64u", a); }
template <typename T, typename... Args>
void OUT(T a, Args... args) {
  OUT(a);
  OUT(" ");
  OUT(args...);
}
template <typename... Args>
void O(Args... args) {
  OUT(args...);
  OUT("\n");
}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
const long long int M = 1000000000000000000;
set<long long int> s;
vector<long long int> v;
long long int sq2(long long int j) {
  long long int low = 1, high = 1000000000;
  while (low < high) {
    long long int mid = (low + high + 1) / 2;
    if (mid * mid <= j)
      low = mid;
    else
      high = mid - 1;
  }
  return low;
}
void g() {
  for (long long int i = 2; i <= 1000000; i++) {
    long long int j = i * i * i;
    while (1) {
      long long int root = sq2(j);
      if (root * root != j) s.insert(j);
      if (M / j < i) break;
      j *= i;
    }
  }
  for (long long int a : s) {
    v.push_back(a);
  }
}
long long int sq(long long int a, long long int b) {
  long long int low = 1, high = 1000000000;
  while (low < high) {
    long long int mid = (low + high) / 2;
    if (mid * mid >= a) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  a = low;
  low = 1, high = 1000000000;
  while (low < high) {
    long long int mid = (low + high + 1) / 2;
    if (mid * mid <= b) {
      low = mid;
    } else {
      high = mid - 1;
    }
  }
  return high - a + 1;
}
long long int query(long long int l, long long int r) {
  auto it = lower_bound(v.begin(), v.end(), r + 1);
  auto it1 = lower_bound(v.begin(), v.end(), l);
  it--;
  long long int ans = 0;
  if (it1 != v.end()) {
    if (*it1 <= r) {
      ans = it - it1 + 1;
    }
  }
  return sq(l, r) + ans;
}
int main() {
  g();
  int q;
  I(q);
  while (q--) {
    long long int l, r;
    I(r);
    l = 2;
    O(r - l + 1 - query(l, r));
  }
  return 0;
}
