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;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << '\n';
  err(++it, args...);
}
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &a) {
  return os << '(' << a.first << ", " << a.second << ')';
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &a) {
  os << '[';
  for (unsigned long long i = 0; i < a.size(); i++)
    os << a[i] << (i < a.size() - 1 ? ", " : "");
  os << ']';
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &a) {
  os << '{';
  for (typename set<T>::iterator it = a.begin(); it != a.end(); it++) {
    typename set<T>::iterator jt = it;
    os << *it << (++jt != a.end() ? ", " : "");
  }
  os << '}';
  return os;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, map<T1, T2> &a) {
  os << "{\n";
  for (typename map<T1, T2>::iterator it = a.begin(); it != a.end(); it++) {
    typename map<T1, T2>::iterator jt = it;
    os << "  " << it->first << ": " << it->second
       << (++jt != a.end() ? ",\n" : "\n");
  }
  os << '}';
  return os;
}
long long primes[105];
void eratosthene() {
  for (long long i = 2; i <= 105 - 5; i++)
    if (primes[i] == 0)
      for (long long j = i; j <= 105 - 5; j += i) primes[j] = i;
}
long long cnt[105];
bool pass[105];
long long n;
long long lim[105];
const long long INF = 1e18;
const double lINF = log(4 * INF);
long long cached[105][64];
long long binPow(long long a, long long q) {
  if (a < 105 && q < 64) {
    if (cached[a][q] != 0) return cached[a][q];
    long long &ret = cached[a][q];
    ret = 1;
    for (long long i = 0; (1LL << i) <= q; i++) {
      if (q & (1LL << i)) ret = (ret * a);
      a = (a * a);
    }
    return ret;
  }
  long long ret = 1;
  for (long long i = 0; (1LL << i) <= q; i++) {
    if (q & (1LL << i)) ret = (ret * a);
    a = (a * a);
  }
  return ret;
}
bool smaller(long long a, long long q, long long num) {
  if (log(a) * q >= lINF) return false;
  if (binPow(a, q) > num) return false;
  return true;
}
void prep() {
  eratosthene();
  for (long long i = 2; i <= 63; i++) {
    long long num = i;
    while (num != 1) {
      long long val = primes[num];
      cnt[i]++;
      long long con = 0;
      while (primes[num] == val) num /= val, con++;
      if (con > 1) pass[i] = true;
    }
  }
  for (long long i = 1; i <= 63; i++) {
    if (pass[i]) continue;
    long long lo = 1, hi = 1e18;
    while (lo != hi) {
      long long mid = (lo + hi + 1) / 2;
      if (smaller(mid, i, INF) == true)
        lo = mid;
      else
        hi = mid - 1;
    }
    lim[i] = hi;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  prep();
  long long T;
  cin >> T;
  while (T--) {
    cin >> n;
    long long ans = 0;
    for (long long i = 1; i <= 63; i++) {
      if (pass[i]) continue;
      long long lo = 1, hi = lim[i];
      while (lo != hi) {
        long long mid = (lo + hi + 1) / 2;
        if (smaller(mid, i, n) == true)
          lo = mid;
        else
          hi = mid - 1;
      }
      hi--;
      if (cnt[i] & 1)
        ans -= hi;
      else
        ans += hi;
    }
    cout << ans << '\n';
  }
}
