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.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
import java.util.Map;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        _1036F solver = new _1036F();
        solver.solve(1, in, out);
        out.close();
    }

    static class _1036F {
        long sqrt(long num) {
//        long lo = 1;
//        long hi = num;
//
//        long ans = 1;
//        while (lo <= hi) {
//            long mid = lo + (hi - lo) / 2;
//
//            if (num / mid >= mid) {
//                ans = Math.max(ans, mid);
//                lo = mid + 1;
//            } else {
//                hi = mid - 1;
//            }
//        }
//
//        return ans;

            long ans = (long) Math.sqrt(num);

            while (ans * ans <= num)
                ans++;

            return ans - 1;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int t = in.nextInt();

            TreeMap<Long, List<Integer>> tm = new TreeMap<>();
            TreeMap<Long, Long> tm2 = new TreeMap<>();

            for (int tt = 0; tt < t; tt++) {
                long n = in.nextLong();

                tm.merge(n, new ArrayList<Integer>(Arrays.asList(tt)), (x, y) ->
                {
                    x.addAll(y);
                    return x;
                });

                tm2.put(n, 0l);

            }

            boolean[] isd = new boolean[1000001];

            for (long i = 2; i <= 1e6; i++) {
                if (!isd[(int) i]) {
                    long cv = i * i;
                    while (true) {
                        if (cv <= 1000000)
                            isd[(int) cv] = true;

                        long cvsq = sqrt(cv);

                        if (cvsq > 1e6 && cvsq * cvsq == cv) {
                        } else {
                            Long ceil = tm.ceilingKey(cv);
                            if (ceil != null) {
                                tm2.merge(ceil, 1l, (x, y) -> x + y);
                            } else {
                                break;
                            }
                        }
                        if ((((long) 1e18) / i) >= cv) {
                            cv *= i;
                        } else {
                            break;
                        }
                    }
                }
            }

            long pval = 0;
            for (Long key : tm2.keySet()) {
                tm2.merge(key, pval, (x, y) -> x + y);
                long sqrt = sqrt(key);
                pval = tm2.get(key);
                if (sqrt > 1000000) {
                    tm2.merge(key, sqrt - 1000000, (x, y) -> x + y);
                }
            }

            long[] ans = new long[t];

            for (Long key : tm.keySet()) {
                for (Integer ind : tm.get(key)) {
                    ans[ind] = key - tm2.get(key) - 1;
                }
            }

            for (int i = 0; i < t; i++) {
                out.println(ans[i]);
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

