import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    double a = sc.nextDouble();
    int aInt = (int) a;
    
    double sqrt = Math.sqrt(a);
    
    double cbrt = Math.cbrt(a);
    
    int ans = 0;
    
    int s = (int) sqrt;
    int s1 = s*s;
    
    int c = (int) cbrt;
    int c1 = c*c*c;
    
    if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    }
    
    if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    }
    
    System.out.println(ans);
    
  }
} import java.util.*; util.* java public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    double a = sc.nextDouble();
    int aInt = (int) a;
    
    double sqrt = Math.sqrt(a);
    
    double cbrt = Math.cbrt(a);
    
    int ans = 0;
    
    int s = (int) sqrt;
    int s1 = s*s;
    
    int c = (int) cbrt;
    int c1 = c*c*c;
    
    if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    }
    
    if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    }
    
    System.out.println(ans);
    
  }
} Main public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    double a = sc.nextDouble();
    int aInt = (int) a;
    
    double sqrt = Math.sqrt(a);
    
    double cbrt = Math.cbrt(a);
    
    int ans = 0;
    
    int s = (int) sqrt;
    int s1 = s*s;
    
    int c = (int) cbrt;
    int c1 = c*c*c;
    
    if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    }
    
    if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    }
    
    System.out.println(ans);
    
  } main {
    Scanner sc = new Scanner(System.in);
    
    double a = sc.nextDouble();
    int aInt = (int) a;
    
    double sqrt = Math.sqrt(a);
    
    double cbrt = Math.cbrt(a);
    
    int ans = 0;
    
    int s = (int) sqrt;
    int s1 = s*s;
    
    int c = (int) cbrt;
    int c1 = c*c*c;
    
    if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    }
    
    if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    }
    
    System.out.println(ans);
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double a = sc.nextDouble(); a sc.nextDouble() sc.nextDouble sc int aInt = (int) a; aInt (int) a double sqrt = Math.sqrt(a); sqrt Math.sqrt(a) Math.sqrt Math a double cbrt = Math.cbrt(a); cbrt Math.cbrt(a) Math.cbrt Math a int ans = 0; ans 0 int s = (int) sqrt; s (int) sqrt int s1 = s*s; s1 s*s s s int c = (int) cbrt; c (int) cbrt int c1 = c*c*c; c1 c*c*c c*c*c c c c if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    } s1 < c1 s1 c1 {
      ans = c1;
    } ans = c1 ans c1 {
      ans = s1;
    } ans = s1 ans s1 if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    } ans < 32 && 32 <= aInt ans < 32 ans 32 32 <= aInt 32 aInt {
      ans = 32;
    } ans = 32 ans 32 if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    } ans < 128 && 128 <= aInt ans < 128 ans 128 128 <= aInt 128 aInt {
      ans = 128;
    } ans = 128 ans 128 if (ans < 243 && 243 <= aInt){
      ans = 243;
    } ans < 243 && 243 <= aInt ans < 243 ans 243 243 <= aInt 243 aInt {
      ans = 243;
    } ans = 243 ans 243 System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    double a = sc.nextDouble();
    int aInt = (int) a;
    
    double sqrt = Math.sqrt(a);
    
    double cbrt = Math.cbrt(a);
    
    int ans = 0;
    
    int s = (int) sqrt;
    int s1 = s*s;
    
    int c = (int) cbrt;
    int c1 = c*c*c;
    
    if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    }
    
    if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    }
    
    System.out.println(ans);
    
  }
} public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    double a = sc.nextDouble();
    int aInt = (int) a;
    
    double sqrt = Math.sqrt(a);
    
    double cbrt = Math.cbrt(a);
    
    int ans = 0;
    
    int s = (int) sqrt;
    int s1 = s*s;
    
    int c = (int) cbrt;
    int c1 = c*c*c;
    
    if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    }
    
    if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    }
    
    System.out.println(ans);
    
  }
} Main
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    double a = sc.nextDouble();
    int aInt = (int) a;
    
    double sqrt = Math.sqrt(a);
    
    double cbrt = Math.cbrt(a);
    
    int ans = 0;
    
    int s = (int) sqrt;
    int s1 = s*s;
    
    int c = (int) cbrt;
    int c1 = c*c*c;
    
    if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    }
    
    if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    }
    
    System.out.println(ans);
    
  }
}