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>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long MOD = 1000000007LL, INF = 1e9, LINF = 1e18;
const long double PI = 3.141592653589793116, EPS = 1e-9,
                  GOLD = ((1 + sqrt(5)) / 2);
template <class T>
int getbit(T s, int i) {
  return (s >> 1) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcount(s);
}
long long Q, L, R;
set<long long> sadpowers;
vector<long long> SadPowers;
long long prime[18] = {2,  3,  5,  7,  11, 13, 17, 19, 23,
                       29, 31, 37, 41, 43, 47, 53, 59, 61};
bool isSquare(long long z) {
  long long zx = sqrt(z);
  return (zx * zx == z);
}
void VarInput() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  for (long long i = 3; i < 63; i++) {
    bool flag = true;
    for (long long j = 0; j <= 1000000; j++) {
      long long zazz = 1;
      for (long long k = 0; k < i; k++) {
        if (j > 0 && 3 * LINF / j < zazz) {
          flag = false;
          break;
        }
        zazz *= j;
      }
      if (!flag) break;
      if (isSquare(zazz)) continue;
      if (sadpowers.find(zazz) == sadpowers.end()) sadpowers.insert(zazz);
    }
  }
  for (auto it = sadpowers.begin(); it != sadpowers.end(); it++)
    SadPowers.push_back(*it);
  cin >> Q;
}
void ProSolve() {
  while (Q--) {
    L = 1;
    cin >> R;
    long long ans = floor(sqrtl(R)) - ceil(sqrtl(L)) + 1;
    long long st =
        lower_bound(SadPowers.begin(), SadPowers.end(), L) - SadPowers.begin();
    long long en =
        upper_bound(SadPowers.begin(), SadPowers.end(), R) - SadPowers.begin();
    ans += (en - st);
    cout << R - ans << '\n';
  }
}
int main() {
  VarInput();
  ProSolve();
  return 0;
}
