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 int N = 303, M = 18;
mt19937 gen(time(NULL));
template <typename T = int>
inline T read() {
  T val = 0, sign = 1;
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') sign = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) val = val * 10 + ch - '0';
  return sign * val;
}
vector<long long> cand;
long long root(long long x) {
  long long l = 0, r = 1e9 + 1;
  while (l < r - 1) {
    long long m = (l + r) / 2;
    if (m * m > x)
      r = m;
    else
      l = m;
  }
  return l;
}
void solve() {
  long long l = 2;
  long long r;
  cin >> r;
  long long ans = upper_bound((cand).begin(), (cand).end(), r) -
                  lower_bound((cand).begin(), (cand).end(), l);
  ans += root(r) - root(l - 1);
  printf("%lld\n", r - 1 - ans);
}
void precalc() {
  long long U = 1e18;
  vector<long long> _cand = {1};
  for (long long i = 2; i <= 1e6; i++)
    for (long long curr = i * i * i; curr <= U; curr *= i) {
      _cand.push_back(curr);
      if (curr > U / i) break;
    }
  sort((_cand).begin(), (_cand).end());
  _cand.erase(unique((_cand).begin(), (_cand).end()), _cand.end());
  for (const long long &u : _cand) {
    long long x = root(u);
    if (x * x == u) continue;
    cand.push_back(u);
  }
  fprintf(stderr, "Precalc: %.3f\n", (double)(clock()) / CLOCKS_PER_SEC),
      fflush(stderr);
}
signed main() {
  precalc();
  int t = read();
  clock_t tot = clock();
  while (t--) {
    clock_t z = clock();
    solve();
  }
  fprintf(stderr, "Total Time: %.3f\n",
          (double)(clock() - tot) / CLOCKS_PER_SEC),
      fflush(stderr);
}
