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 GCC optimize(3, "Ofast", "inline")
using namespace std;
bool Finish_read;
template <class T>
inline void read(T &x) {
  Finish_read = 0;
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    if (ch == EOF) return;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
  Finish_read = 1;
}
template <class T>
inline void print(T x) {
  if (x / 10 != 0) print(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void writeln(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar('\n');
}
template <class T>
inline void write(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
}
const long long lim = 1e18;
int T, miu[1005], notprime[1005];
long long n, pre[1005][1005], maxbase[1005], bit[63];
vector<int> prime;
inline void sieve() {
  miu[0] = 1, notprime[1] = 0;
  for (int i = 2; i <= 1000; ++i) {
    if (!notprime[i]) {
      prime.push_back(i);
      miu[i] = -1;
    }
    for (int j = 0; j < prime.size() && i * prime[j] < 1005; ++j) {
      notprime[i * prime[j]] = 1;
      miu[i * prime[j]] = -miu[i];
      if (!(i % prime[j])) {
        miu[i * prime[j]] = 0;
        break;
      }
    }
  }
}
inline long long id(int o, long long x) {
  return maxbase[o] == 2
             ? 1
             : upper_bound(pre[o] + 1, pre[o] + maxbase[o] + 1, n) - pre[o] - 2;
}
inline bool overflow(long long x, long long y, long long lim) {
  return lim / y < x;
}
inline long long Kissme(long long x, long long y, long long lim) {
  long long res = 1;
  while (y) {
    if (y & 1) {
      if (overflow(x, res, lim)) return 0;
      res *= x;
    }
    y >>= 1;
    if (!y) break;
    if (overflow(x, x, lim)) return 0;
    x *= x;
  }
  return res <= lim ? res : 0;
}
inline long long k_sqrt(long long x, long long k) {
  long long cnt = pow(x, 1 / (double)k);
  for (; Kissme(cnt + 1, k, x); ++cnt)
    ;
  for (; !Kissme(cnt, k, x); --cnt)
    ;
  return cnt;
}
inline void solve(long long x) {
  long long ans = x;
  for (int i = 2; i <= 5; ++i) {
    if (bit[i] > n) break;
    long long base = k_sqrt(n, i);
    ans += (base - 1) * miu[i];
  }
  for (int i = 6; bit[i] <= n; ++i) ans += miu[i] * id(i, n);
  printf("%lld\n", ans - 1);
}
inline void prework() {
  bit[0] = 1;
  for (int i = 1; i < 63; ++i) bit[i] = bit[i - 1] << 1;
  for (long long expo = 6, base, Ans; expo <= 61;
       maxbase[expo] = base - 1, ++expo)
    for (pre[expo][1] = 1, base = 2, Ans = Kissme(base, expo, lim);
         (pre[expo][base] = Ans) != 0; ++base, Ans = Kissme(base, expo, lim))
      ;
}
int main() {
  sieve(), prework();
  for (read(T); T--;) read(n), solve(n);
}
