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 optimize("avx")
#pragma optimize("no-stack-protector")
namespace io {
inline char gnc() { return (char)getchar(); }
template <typename T>
inline void gi(T &dx) {
  dx = 0;
  int yc = gnc();
  bool nega = false;
  while (yc < '0' || yc > '9') {
    nega = (yc == '-' ? true : nega);
    yc = gnc();
  }
  while (yc >= '0' && yc <= '9') {
    dx = (T)(dx * 10 + yc - '0');
    yc = gnc();
  }
  if (nega) {
    dx = -dx;
  }
}
void gc(char &a) {
  do a = gnc();
  while (!isgraph(a));
}
void gss(char *c) {
  *c = gnc();
  while (!isgraph(*c)) *c = gnc();
  while (isgraph(*c)) *++c = gnc();
  *c = 0;
}
template <typename t1, typename t2>
inline void gi(t1 &a, t2 &b) {
  gi(a);
  gi(b);
}
template <typename t1, typename t2, typename t3>
inline void gi(t1 &a, t2 &b, t3 &c) {
  gi(a);
  gi(b);
  gi(c);
}
template <typename t1, typename t2, typename t3, typename t4>
inline void gi(t1 &a, t2 &b, t3 &c, t4 &d) {
  gi(a);
  gi(b);
  gi(c);
  gi(d);
}
template <typename t1, typename t2, typename t3, typename t4, typename t5>
inline void gi(t1 &a, t2 &b, t3 &c, t4 &d, t5 &e) {
  gi(a);
  gi(b);
  gi(c);
  gi(d);
  gi(e);
}
}  // namespace io
using namespace io;
using namespace std;
inline int gcd(int x, int y) {
  return y > x ? gcd(y, x) : y ? gcd(y, x % y) : x;
}
inline void exgcd(int a, int b, int &x, int &y) {
  if (!b) {
    x = 1;
    y = 0;
    return;
  }
  exgcd(b, a % b, x, y);
  int t = x;
  x = y;
  y = t - (a / b) * y;
}
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int Rev = 5e8 + 4;
template <typename T>
inline void Sol(T &x) {
  if (x >= MOD) x -= MOD;
}
template <typename T1, typename T2>
inline void Inc(T1 &x, T2 y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
template <typename T1, typename T2>
inline void Dec(T1 &x, T2 y) {
  x += MOD - y;
  if (x >= MOD) x -= MOD;
}
inline long long qpow(long long x, int y) {
  long long res = 1;
  for (; y; y >>= 1, x = x * x % MOD)
    if (y & 1) res = res * x % MOD;
  return res;
}
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
template <typename T>
inline void Getmin(T &x, T y) {
  if (x > y) x = y;
}
template <typename T>
inline void Getmax(T &x, T y) {
  if (x < y) x = y;
}
long long n;
map<long long, bool> mark;
vector<long long> tumple;
inline bool square(long long x) {
  long long t = sqrt(x);
  return t * t == x || (t + 1) * (t + 1) == x || (t - 1) * (t - 1) == x;
}
int main() {
  int T;
  gi(T);
  n = 1e18;
  for (long long j = 2, prod = j * j; j <= 1000000; j++, prod = j * j) {
    prod *= j;
    if (prod > n) break;
    for (int i = 3; i <= 60; i++) {
      if (!square(prod) && !mark.count(prod))
        mark[prod] = 1, tumple.push_back(prod);
      if ((double)prod * j > n) break;
      prod *= j;
    }
  }
  sort(tumple.begin(), tumple.end());
  while (T--) {
    gi(n);
    long long ans = n - (int)sqrt(n);
    long long x =
        upper_bound(tumple.begin(), tumple.end(), n) - tumple.begin() - 1;
    ans -= x + 1;
    printf("%lld\n", ans);
  }
  return 0;
}
