human
Write me a Python code to find the number of such x that x is a square of a positive integer number or a cube of a positive integer number (or both a square and a cube simultaneously) given the following:
Polycarp likes squares and cubes of positive integers. Here is the beginning of the sequence of numbers he likes: 1, 4, 8, 9, ....

For a given number n, count the number of integers from 1 to n that Polycarp likes. In other words, find the number of such x that x 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 t (1 ≤ t ≤ 20) — the number of test cases.

Then t lines contain the test cases, one per line. Each of the lines contains one integer n (1 ≤ n ≤ 10^9).

Output

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

Example

Input

6
10
1
25
1000000000
999999999
500000000

Output

4
1
6
32591
32590
23125
The above is tricky. Write me a correct solution in PYTHON.
assistant
#Here is Python code to find the number of such x that x is a square of a positive integer number or a cube of a positive integer number (or both a square and a cube simultaneously).

import sys
testing = len(sys.argv) == 4 and sys.argv[3] == "myTest"
interactive = False
if testing:
    cmd = sys.stdout
    from time import time
    start_time = int(round(time() * 1000)) 
    readAll = open(sys.argv[1], 'r').read
    sys.stdout = open(sys.argv[2], 'w')
else:
    readAll = sys.stdin.read

# ############ ---- I/O Functions ---- ############

class InputData:
    def __init__(self):
        self.lines = readAll().split('\n')
        self.n = len(self.lines)
        self.ii = -1
    def input(self):
        self.ii += 1
        assert self.ii < self.n
        return self.lines[self.ii]

flush = sys.stdout.flush
if interactive and not testing:
    input = sys.stdin.readline
else:
    inputData = InputData()
    input = inputData.input

def intin():
    return(int(input()))
def intlin():
    return(list(map(int,input().split())))
def chrin():
    return(list(input()))
def strin():
    return input()
def lout(l, sep="\n", toStr=True):
    print(sep.join(map(str, l) if toStr else l))
def dout(*args, **kargs):
    if not testing: return
    if args: print(args[0] if len(args)==1 else args)
    if kargs: print([(k,v) for k,v in kargs.items()])
def ask(q):
    sys.stdout.write(str(q)+'\n')
    flush()
    return intin()
    
# ############ ---- I/O Functions ---- ############

# from math import ceil
# from collections import defaultdict as ddict, Counter
# from heapq import *
# from Queue import Queue
a = []
i = 1
while i*i <= 10**9:
    a.append(i*i)
    i += 1
i = 1
while i*i*i <= 10**9:
    a.append(i*i*i)
    i += 1
a = sorted(list(set(a)))
# dout(a)

def BS(a, x):
    low = 0
    high = len(a)-1
    while low <= high:
        mid = (high + low) / 2
        if a[mid] < x:
            low  = mid + 1
        elif a[mid] > x:
            high = mid - 1
        else:
            return mid, mid
    return high, low

def main():
    n = intin()
    bs = BS(a, n)
    return bs[0]+1
    

anss = []
for _ in xrange(intin()):
    anss.append(main())
    # anss.append("YES" if main() else...