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.*;
  
  public class Main {
  	public static void main(String[] args) throws FileNotFoundException,IOException,Exception {
          boolean isFile = true;
          isFile &= false;
          ScanReader in;PrintWriter out;
  
          if(isFile) {
              InputStream inputStream = new FileInputStream("input.txt");
              in = new ScanReader(inputStream,new BufferedReader(new FileReader("input.txt")));
              out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
  
          } else {
              InputStream inputStream = System.in;
              in = new ScanReader(inputStream,new BufferedReader(new InputStreamReader(System.in)));
              out = new PrintWriter(System.out);
          }
  
          Palindrome solver = new Palindrome();
  
          int t = 1;
          // t = in.nextInt();
  
          for (int i = 0; i < t; i++) {
              solver.solve(i + 1, in, out);
          }
  
          out.close();
  	}
  
      static class Palindrome {
          static long mod = 1000000007;
          static long maxX = (long) 1e18;
          static long mod2 = 998244353;
  
          //  Check for boundary Condition because you are not Sehwag..
          //  For multiple Test cases take all input -> do not use return while taking input.
          //  at least check constraint for once it can be done in nested loops.
          //  Think simple and short
          //  check for proof of solution
          //  Read editorial after contest.....
  
          void solve(int testNumber, ScanReader in, PrintWriter out) throws Exception {
  
              
              ArrayList<Long> ar = new ArrayList<>();
              
              long x = 1, y = 1;
  
              while(x*x<mod || y*y*y<mod) {
                  if(x*x<y*y*y) {
                      ar.add(x*x);
                      x++;
                  } else if (x*x > y*y*y){
                      ar.add(y*y*y);
                      y++;
                  } else {
                      ar.add(x*x);
                      x++;
                      y++;
                  }
              }
  
              int t = in.nextInt();            
  
              while(t-->0) {
  
                  long p = in.nextLong();
  
                  int l = -1;
                  int r = ar.size();
  
                  while(l+1<r) {
                      int m = (l+r)/2;
  
                      if(ar.get(m) <= p) {
                          l = m;
                      } else {
                          r = m;
                      }
                  }
  
                  out.println(r);
              }
  
          }  
      }
  
      
      static class ScanReader {
          private final InputStream stream;
          private byte[] buf = new byte[1024];
          private int curChar;
          private int numChars;
          private SpaceCharFilter filter;
          private BufferedReader br;
  
          public ScanReader(InputStream stream,BufferedReader br) {
          this.stream = stream;
              this.br = br;
          }
  
          public int read() {
              if (numChars == -1)
                  throw new InputMismatchException();
  
              if (curChar >= numChars) {
                  curChar = 0;
                  try {
                      numChars = stream.read(buf);
                  } catch (IOException e) {
                      throw new InputMismatchException();
                  }
  
                  if (numChars <= 0)
                      return -1;
              }
              return buf[curChar++];
          }
  
          public String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
  
          public int nextInt() {
              int c = read(); 
  
              while (isSpaceChar(c))
                  c = read();
  
              int sgn = 1;
  
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
  
              int res = 0;
              do {
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              while (!isSpaceChar(c));
  
              return res * sgn;
          }
  
          public long nextLong() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              long res = 0;
  
              do {
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              while (!isSpaceChar(c));
              return res * sgn;
          }
  
          public double nextDouble() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              double res = 0;
              while (!isSpaceChar(c) && c != '.') {
                  if (c == 'e' || c == 'E')
                      return res * Math.pow(10, nextInt());
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              if (c == '.') {
                  c = read();
                  double m = 1;
                  while (!isSpaceChar(c)) {
                      if (c == 'e' || c == 'E')
                          return res * Math.pow(10, nextInt());
                      if (c < '0' || c > '9')
                          throw new InputMismatchException();
                      m /= 10;
                      res += (c - '0') * m;
                      c = read();
                  }
              }
              return res * sgn;
          }
  
          public String readString() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              StringBuilder res = new StringBuilder();
              do {
                  res.appendCodePoint(c);
                  c = read();
              }
              while (!isSpaceChar(c));
  
              return res.toString();
          }
  
          public boolean isSpaceChar(int c) {
              if (filter != null)
                  return filter.isSpaceChar(c);
              return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }
  
          public String next() {
              return readString();
          }
  
          public interface SpaceCharFilter {
              public boolean isSpaceChar(int ch);
          }
      }
  }