CF1619B.Squares and Cubes

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Squares and Cubes

Polycarp likes squares and cubes of positive integers. Here is the beginning of the sequence of numbers he likes: 11, 44, 88, 99, ....

For a given number nn, count the number of integers from 11 to nn that Polycarp likes. In other words, find the number of such xx that xx is a square of a positive integer number or a cube of a positive integer number (or both a square and a cube simultaneously).

Input

The first line contains an integer tt (1t201 \le t \le 20) — the number of test cases.

Then tt lines contain the test cases, one per line. Each of the lines contains one integer nn (1n1091 \le n \le 10^9).

Output

For each test case, print the answer you are looking for — the number of integers from 11 to nn that Polycarp likes.

Samples

6
10
1
25
1000000000
999999999
500000000
4
1
6
32591
32590
23125

在线编程 IDE

建议全屏模式获得最佳体验