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.util.*;
  import java.io.*;
  
  //           THIS TEMPLATE MADE BY AKSH BANSAL.
  
  public class Solution {
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
          public FastReader() {
              br = new BufferedReader(new InputStreamReader(System.in));
          }
          String next() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
          int nextInt() {
              return Integer.parseInt(next());
          }
          long nextLong() {
              return Long.parseLong(next());
          }
          double nextDouble() {
              return Double.parseDouble(next());
          }
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
      }
      static void sort(int a[]){ // int -> long
          ArrayList<Integer> arr=new ArrayList<>(); // Integer -> Long
          for(int i=0;i<a.length;i++)
          arr.add(a[i]);
          Collections.sort(arr);
          for(int i=0;i<a.length;i++)
          a[i]=arr.get(i);
          
      }
      private static long gcd(long a, long b){
          if(b==0)return a;
          return gcd(b,a%b);
      }
      private static long pow(long x,long y){
          if(y==0)return 1;
          long temp = pow(x, y/2);
          if(y%2==1){
              return x*temp*temp;
          }
          else{
              return temp*temp;
          }
      }
      static int log(long n){
          int res = 0;
          while(n>0){
              res++;
              n/=2;
          }
          return res;
      }
  
      static int mod = (int)1e9+7;
      static PrintWriter out;
      static FastReader sc ;
      
      public static void main(String[] args) throws IOException {
          sc = new FastReader();
          out = new PrintWriter(System.out);
          // primes();
          // ________________________________
  
          int test = sc.nextInt();
          StringBuilder output = new StringBuilder();
          while (test-- > 0) {
             
            // System.out.println();
         long n = sc.nextLong();
          
          
           
          
          
              output.append(solver(n)).append("\n");
          }
  
          out.println(output);
          // _______________________________
  
          // int n = sc.nextInt();
          // out.println(solver());
          // ________________________________
          out.flush();
      }
      //static ArrayList<Long>al =new ArrayList<>();
      public static String solver(Long n) {
      	long ans = (long)Math.sqrt((long)n)+ (long)Math.cbrt((long)n)-SquareCube(n);
      	return ans+"";
      	
      }
      static long SquareCube(long N)
      {
       
          long cnt = 0, i = 1;
       
          while ((int)(Math.pow(i, 6)) <= N) {
              ++cnt;
              ++i;
          }
       
          return cnt;
      }
      static long findGCD(ArrayList<Long>arr, long n)
      {
          long result = 0;
          for (long element: arr){
              result = gcd(result, element);
   
              if(result == 1)
              {
                 return 1;
              }
          }
   
          return result;
      }
      static void rotate(int [] arr, int s, int n)
      {
         int x = arr[n], i;
         for (i = n; i > s; i--)
            arr[i] = arr[i-1];
         arr[s] = x;
  //       for(int j=s;j<=n;j++)
  //    	   System.out.print(arr[j]+" ");
        // System.out.println();
      }
  static void reverseArray(int arr[], int start,
              int end)
  {
  while (start < end)
  {
  int temp = arr[start];
  arr[start] = arr[end];
  arr[end] = temp;
  start++;
  end--;
  }
  }
  }