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;
long long modx(long long Base, long long exponent) {
  long long ans = 1;
  if (Base == 1) return Base;
  while (exponent) {
    if (exponent & 1) ans = (ans * Base) % 1000000007LL;
    Base = (Base * Base) % 1000000007LL;
    exponent = exponent >> 1;
  }
  return ans;
}
long long inmodx(long long num) { return (modx(num, 1000000007LL - 2LL)); }
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return (a.first * a.second >= b.first * b.second);
}
const int N = (60) + 9;
const int M = (N << 2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 600;
long long val[N], cnt[N], temp[N];
bool check(long long a, int n, long long x) {
  long long ans = 1LL;
  while (n > 0) {
    if (n & 1) {
      if (ans > x / a) return 0;
      ans *= a;
    }
    n >>= 1;
    if (a > x / a && n > 0) return 0;
    a *= a;
  }
  return 1;
}
long long pre_compute(int n) {
  int i, j;
  for (i = (1); i < (n + 1); i++) temp[i] = 0;
  temp[n] = 1;
  for (i = n; i > 0; i--)
    for (j = i + i; j <= n; j += i) temp[i] -= temp[j];
  return temp[1];
}
void solve() {
  int i, ind, j;
  long long n, ans;
  cin >> n;
  if (n < 4LL) {
    cout << (n - 1LL) << '\n';
    return;
  }
  val[1] = n;
  for (i = (2); i < (65); i++) {
    val[i] = (long long)pow(1.0 * n, 1.0 / i);
    val[i]--;
    val[i] = max(val[i], 1LL);
    while (check(val[i] + 1LL, i, n)) val[i]++;
    if (val[i] <= 1LL) {
      ind = i - 1;
      break;
    }
  }
  ans = 0;
  for (i = (1); i < (ind + 1); i++) {
    val[i]--;
    ans += (cnt[i] * val[i]);
  }
  cout << ans << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1, cs;
  cnt[1] = 1;
  for (int i = 2; i < N; i++) cnt[i] = pre_compute(i);
  cin >> t;
  for (cs = (1); cs < (t + 1); cs++) {
    solve();
  }
  return 0;
}
