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 = 100;
int yep[N];
int prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};
vector<long long> c;
bool check(long long n) {
  long long tmp = sqrt(n);
  while (tmp * tmp < n) tmp++;
  while (tmp * tmp > n) tmp--;
  return (tmp * tmp) == n;
}
void init() {
  for (int i = 0; i < 60; ++i) yep[i] = 1;
  for (int i = 0; i < 60; ++i)
    for (int j = 0; j < 17; ++j)
      if (i % prime[j] == 0) yep[i] = -yep[i];
  for (int i = 0; i < 60; ++i)
    for (int j = 0; j < 17; ++j)
      if (i % (prime[j] * prime[j]) == 0) yep[i] = 0;
  for (int i = 3; i < 60; ++i) {
    for (int l = 2;; ++l) {
      if (i * log10(l) > 18) {
        break;
      }
      long long nani = 1;
      for (int o = 0; o < i; ++o) nani *= l;
      if (!check(nani)) c.push_back(nani);
    }
  }
  sort(c.begin(), c.end());
  c.resize(distance(c.begin(), unique(c.begin(), c.end())));
}
int n;
int main() {
  init();
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    long long q;
    cin >> q;
    long long tmp = sqrt(q);
    while (tmp * tmp > q) tmp--;
    while ((tmp + 1) * (tmp + 1) <= q) tmp++;
    cout << q - tmp - (lower_bound(c.begin(), c.end(), q + 1) - c.begin())
         << "\n";
  }
}
