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;
struct P {
  long long x, y, z;
  bool operator<(const P &a) const { return x < a.x; }
};
vector<int> v[1];
int a, c, i, b, n, m, k, d;
long long o[331111];
int l[93];
int j[1111];
int e[99];
int dx[10] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[10] = {1, 0, -1, 0, 1, -1, 1, -1},
    dz[10] = {0, 0, 0, 0, 1, -1};
long long x, y, mod = 1000000007, mod2 = 1000000009, mod3 = 2017;
long long z;
double pi = 3.14159265;
P u[222221];
queue<P> q, q1;
map<int, int> p[3];
bool as(P a, P b) { return a.x > b.x; }
long long f(long long n, int m) {
  long long p = 1;
  for (; m; m /= 2) {
    if (m % 2) {
      if (p > mod * mod * 2 / n)
        p = mod * mod * 2;
      else
        p *= n;
    }
    if (n > mod * mod * 2 / n)
      n = mod * mod * 2;
    else
      n *= n;
  }
  return p;
}
int main() {
  for (int t = 2; t <= 60; t++) {
    for (int h = 2; h < t; h++)
      if (t % h == 0) {
        goto qwe;
      }
    e[t] = 1;
  qwe:;
  }
  for (int t = 2; t <= 60; t++) {
    j[t] = -1;
    for (int h = 2; h <= t; h++)
      if (e[h] && t % h == 0) {
        if (t % (h * h) == 0) {
          j[t] = 0;
          goto qw;
        }
        j[t] *= -1;
      }
  qw:;
  }
  scanf("%d", &a);
  for (int t = 1; t <= a; u[t].y = t, t++) scanf("%lld", &u[t].x);
  sort(u + 1, u + a + 1, as);
  l[3] = 1000000;
  l[4] = 40000;
  l[5] = 10000;
  for (int t = 6; t <= 60; l[t] = 1000, t++)
    ;
  for (int t = 1; t <= a; t++) {
    l[2] = sqrt(u[t].x);
    o[u[t].y] = u[t].x;
    for (int h = 2; h <= 60; h++) {
      for (; f(l[h], h) > u[t].x; l[h]--)
        ;
      o[u[t].y] -= (j[h] * (l[h] - 1));
    }
  }
  for (int t = 1; t <= a; t++) printf("%lld\n", o[t] - 1);
}
