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.*;
  
  public class test {
  
      static long mod = 1000000007;
      static long inf = Long.MAX_VALUE;
      static final int maxSizeSeive = 1000001;
      static Vector<Boolean>isprime = new Vector<>(maxSizeSeive);
      static Vector<Integer>prime = new Vector<>();
      static Vector<Integer>SPF = new Vector<>(maxSizeSeive);
  
      public static void solve(long n) {
          long limit = (long)Math.sqrt(n);
          HashSet<Long> set = new HashSet<>();
          for(long i  = 1; i <= limit; i++) {
              long sq = (long)Math.pow(i, 2);
              long cu = (long)Math.pow(i, 3);
              if(sq <= n) {
                  set.add(sq);
              }
              if(cu <= n) {
                  set.add(cu);
              }
          }
          System.out.println(set.size());
      }
      
  /*
  input:
  6
  10
  1
  25
  1000000000
  999999999
  500000000
  
  
  output:
  4
  1
  6
  32591
  32590
  23125
  
  
  */
  
      public static void main(String[] args) {
          FastReader sc = new FastReader();
          int t = sc.nextInt();
          while(t-- > 0) {
              long n = sc.nextLong();
              // solve
              solve(n);
          }
      }
  
      public static ArrayList<Integer> seivePrime(int n) {
          ArrayList<Integer> primes = new ArrayList<>();
          for (int i = 0; i < maxSizeSeive; i++){
              isprime.add(true);
              SPF.add(2);
          }
  
          manipulated_seive(n);
  
          for (int i=0; i<prime.size() && prime.get(i) <= n; i++) {
              primes.add(prime.get(i));
          }
          return primes;
      }
  
      public static void manipulated_seive(int N) {
          isprime.set(0, false);
          isprime.set(1, false);
           
          for (int i=2; i<N ; i++) {
              if (isprime.get(i)) {
                  prime.add(i);
                  SPF.set(i,i);
              }
  
              for (int j=0;j < prime.size() && i*prime.get(j) < N && prime.get(j) <= SPF.get(i);j++) {
                  isprime.set(i*prime.get(j),false);
                  SPF.set(i*prime.get(j),prime.get(j));
              }
          }
      }    
       
  	public static void sort(long[] a) {
  		ArrayList<Long> l=new ArrayList<>();
  		for (long i:a) l.add(i);
  		Collections.sort(l);
  		for (int i=0; i<a.length; i++) a[i]=l.get(i);
  	}
  
      public static int maxIndex(long[] arr) {
          long max = Long.MIN_VALUE;
          int index = 0;
          int n = arr.length;
          for(int i = 0; i < n; i++) {
              if(arr[i] > max) {
                  index = i;
                  max = arr[i];
              }
          }
          return index;
      }
  
      public static int minIndex(long[] arr) {
          long min = Long.MAX_VALUE;
          int index = 0;
          int n = arr.length;
          for(int i = 0; i < n; i++) {
              if(arr[i] < min) {
                  index = i;
                  min = arr[i];
              }
          }
          return index;
      }
  
      public static void debugArray(long[] arr) {
          for(int i = 0; i < arr.length; i++) {
              System.out.print(arr[i] + " ");
          }
          System.out.println();
      } 
  
      public static void debugArrayList(ArrayList<Long> arr) {
          for(Long i : arr) {
              System.out.print(i + " ");
          }
          System.out.println();
      }
  
      public static long gcd(long a, long b) {
          if(b == 0) {
              return a;
          }
          else {
              return gcd(b, a % b);
          }
      }
   
      public static long LCM(long a, long b) {
          return Math.abs(a*b) / gcd(a, b);
      }
  
      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();
          }
  
          String nextLine() {
              String str="";
              try {
                  str=br.readLine();
              }
              catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          long[] readArray(int n) {
              long[] a = new long[n];
              for(int i = 0; i < n ; i++) {
                  a[i] = nextLong();
              }
              return a;
          }
      }
  }