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;
using INT = long long;
using pii = pair<int, int>;
int flag[110000], mb[110000];
vector<INT> pw[60];
INT power(INT x, int n) {
  INT ans = 1;
  for (int i = 1; i <= n; i++) ans = ans * x;
  return ans;
}
void pre() {
  for (int i = 2; i < 110000; i++) {
    if (flag[i]) continue;
    for (int j = i; j < 110000; j += i) flag[j] = i;
  }
  mb[1] = 1;
  for (int i = 2; i < 110000; i++) {
    int p = flag[i];
    if ((i / p) % p == 0)
      mb[i] = 0;
    else {
      mb[i] = -mb[i / p];
    }
  }
  for (int i = 4; i < 60; i++) {
    pw[i].push_back(1);
    INT x = 2;
    while (1) {
      int flag = 0;
      INT t = 1;
      for (int j = 1; j <= i; j++) {
        if (t <= 1000000000000000000ll / x) {
          t *= x;
          continue;
        }
        flag = 1;
        break;
      }
      if (flag) break;
      pw[i].push_back(t);
      x++;
    }
  }
}
INT calc(INT n, int d) {
  if (d == 2) {
    INT x = sqrtl(n);
    if ((x + 1) * (x + 1) <= n) return x;
    if (x * x <= n) return x - 1;
    return x - 2;
  }
  if (d == 3) {
    INT x = cbrtl(n);
    if ((x + 1) * (x + 1) * (x + 1) <= n) return x;
    if (x * x * x <= n) return x - 1;
    return x - 2;
  }
  int id = upper_bound(pw[d].begin(), pw[d].end(), n) - pw[d].begin() - 1;
  return id;
}
int main() {
  pre();
  int T;
  cin >> T;
  while (T--) {
    INT n;
    scanf("%I64d", &n);
    INT ans = n - 1;
    for (int i = 2; i < 60; i++) {
      ans += mb[i] * calc(n, i);
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
