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.util.*;
  // import javafx.util.*;
  
   public class codeforces {
  
    static class Reader {
  
      private final 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') {
            if (cnt != 0) {
              break;
            } else {
              continue;
            }
          }
          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();
      }
    }
  
    public static void main(String[] args) throws IOException {
      
        int t,i;
        
        Scanner sc = new Scanner(System.in);
  
        t = sc.nextInt();
        while(t-->0){
         long n = sc.nextLong();
         long cube_root = (long)Math.cbrt(  Math.sqrt( n)  );
         long ans = (long)Math.sqrt(n) + (long)Math.cbrt(n)  - cube_root ;   // (m^2)^3 = (m^3)^2 , (( m^3)^2)^2=((m^2)^3)^2 ; 
        
         System.out.println(ans);
     }
   }
  }
  