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;
vector<int> minimum_prime_fuctors(int x) {
  vector<int> res(x + 1);
  vector<int> primes;
  for (int i = 2; i <= x; i++) {
    if (res[i] == 0) {
      res[i] = i;
      primes.push_back(i);
    }
    for (int j = 0;
         j < primes.size() && primes[j] <= res[i] && primes[j] * i <= x; j++) {
      res[i * primes[j]] = primes[j];
    }
  }
  return res;
}
vector<int> mobius_function(int x) {
  vector<int> res(x + 1);
  vector<int> mp = minimum_prime_fuctors(x);
  res[1] = 1;
  for (int i = 2; i <= x; i++) {
    if (mp[i] == mp[i / mp[i]])
      res[i] = 0;
    else
      res[i] = -res[i / mp[i]];
  }
  return res;
}
const vector<long long> sqrt_upp = {
    0,  0,  3037000499, 2097151, 55108, 6208, 1448, 511, 234, 127,
    78, 52, 38,         28,      22,    18,   15,   13,  11,  9,
    8,  7,  7,          6,       6,     5,    5,    5,   4,   4,
    4,  4,  3,          3,       3,     3,    3,    3,   3,   3};
long long sqrt(long long x, int y) {
  if (y == 1) return x;
  if (x == 0) return 0;
  if (y >= 63) return 1;
  if (x < (1LL << y)) return 1;
  if (y >= sqrt_upp.size()) return 2;
  int bit = (64 - __builtin_clzll(x) - 1) / y;
  long long left = (1LL << bit), right = (left << 1);
  right = min(right, sqrt_upp[y]);
  while (left < right) {
    long long mid = (left + right + 1) / 2;
    long long v = 1, b = y, c = mid;
    while (b) {
      if (b & 1) v *= c;
      b /= 2;
      if (b) c *= c;
    }
    if (v <= x)
      left = mid;
    else
      right = mid - 1;
  }
  return left;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<int> mo = mobius_function(80);
  int t;
  cin >> t;
  while (t--) {
    long long x;
    cin >> x;
    long long res = x - 1;
    for (int i = 2; i < mo.size(); i++) {
      long long c = sqrt(x, i) - 1;
      res += mo[i] * c;
    }
    cout << res << "\n";
  }
  return 0;
}
