description: 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
solution: import java.io.*;
  import java.math.BigInteger;
  import java.util.*;
  
  public class Pratice{
      final long mod = 1000000007;
      static StringBuilder sb=new StringBuilder();
  
      static boolean ans;
      static int xn = (int) (2e5 + 10);
      static int sqrt_max=1000000;
      static int cube_max=10000;
      static Set<Long> set=new TreeSet<>();
      static
      {
          long n=1000000001;
  
  
          for(int i=1;i*i<=n;i++)
          {
              long x=i*i;
              set.add(x);
          }
  
          for(int i=1;i*i*i<=n;i++)
          {
              long x=i*i*i;
              set.add(x);
          }
  
      }
  
      public static void main(String[] args) throws IOException {
          Reader reader = new Reader();
          int t = reader.nextInt();
          while (t-- > 0) {
  
              long n=reader.nextLong();
              long ans=0;
              for (long x:set)
              {
                  if(x<=n)
                  {
                      ans++;
                  }
                  else
                  {
                      break;
                  }
              }
  
              System.out.println(ans);
  
          }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
          }
  
  
  
  
  
  
      public static long[] inarr(long n) throws IOException {
          Reader reader = new Reader();
          long arr[]=new long[(int) n];
          for (long i = 0; i < n; i++) {
              arr[(int) i]=reader.nextLong();
          }
  
          return arr;
  
      }
  
      public static boolean checkPerfectSquare(int number)
      {
          int x=number % 10;
  
          if (x==2 || x==3 || x==7 || x==8)
          {
              return false;
          }
          for (int i=0; i<=number/2 + 1; i++)
          {
              if (i*i==number)
              {
                  return true;
              }
          }
          return false;
      }
  
      // check number is prime or not
      public static boolean isPrime(int n) {
          return BigInteger.valueOf(n).isProbablePrime(1);
      }
  
      // return the gcd of two numbers
      public static long gcd(long a, long b)
      {
          BigInteger b1 = BigInteger.valueOf(a);
          BigInteger b2 = BigInteger.valueOf(b);
          BigInteger gcd = b1.gcd(b2);
          return gcd.longValue();
      }
  
  
  
      // number of digits in the given number
      public static int numberOfDigits(int n)
      {
          int ans= (int) (Math.floor((Math.log10(n)))+1);
          return ans;
      }
  
      // return most significant bit in the number
      public static long mostSignificantNumber(long n)
      {
          double k=Math.log10(n);
          k=k-Math.floor(k);
  
          int ans=(int)Math.pow(10,k);
          return ans;
      }
  
  
      static class Reader {
          final private int BUFFER_SIZE = 1 << 16;
          private DataInputStream din;
          private byte[] buffer;
          private int bufferPointer, bytesRead;
  
          public Reader() {
              din = new DataInputStream(System.in);
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
  
          public Reader(String file_name) throws IOException {
              din = new DataInputStream(new FileInputStream(file_name));
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
  
          public String readLine() throws IOException {
              byte[] buf = new byte[64]; // line length
              int cnt = 0, c;
              while ((c = read()) != -1) {
                  if (c == '\n')
                      break;
                  buf[cnt++] = (byte) c;
              }
              return new String(buf, 0, cnt);
          }
  
          public int nextInt() throws IOException {
              int ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
  
              if (neg)
                  return -ret;
              return ret;
          }
  
          public long nextLong() throws IOException {
              long ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              }
              while ((c = read()) >= '0' && c <= '9');
              if (neg)
                  return -ret;
              return ret;
          }
  
          public double nextDouble() throws IOException {
              double ret = 0, div = 1;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
  
              do {
                  ret = ret * 10 + c - '0';
              }
              while ((c = read()) >= '0' && c <= '9');
  
              if (c == '.') {
                  while ((c = read()) >= '0' && c <= '9') {
                      ret += (c - '0') / (div *= 10);
                  }
              }
  
              if (neg)
                  return -ret;
              return ret;
          }
  
          private void fillBuffer() throws IOException {
              bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
              if (bytesRead == -1)
                  buffer[0] = -1;
          }
  
          private byte read() throws IOException {
              if (bufferPointer == bytesRead)
                  fillBuffer();
              return buffer[bufferPointer++];
          }
  
          public void close() throws IOException {
              if (din == null)
                  return;
              din.close();
          }
      }
  }