import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    if(x ==1){
      System.out.println(1);
      return;
    }
    int jou;
    int max = -1;
    for(int i = 2;i<=100;i++){
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    }
    System.out.println(max);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    if(x ==1){
      System.out.println(1);
      return;
    }
    int jou;
    int max = -1;
    for(int i = 2;i<=100;i++){
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    }
    System.out.println(max);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    if(x ==1){
      System.out.println(1);
      return;
    }
    int jou;
    int max = -1;
    for(int i = 2;i<=100;i++){
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    }
    System.out.println(max);
  } main {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    if(x ==1){
      System.out.println(1);
      return;
    }
    int jou;
    int max = -1;
    for(int i = 2;i<=100;i++){
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    }
    System.out.println(max);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc if(x ==1){
      System.out.println(1);
      return;
    } x ==1 x 1 {
      System.out.println(1);
      return;
    } System.out.println(1) System.out.println System.out System System.out 1 return; int jou; jou int max = -1; max -1 1 for(int i = 2;i<=100;i++){
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    } int i = 2; int i = 2; i 2 i<=100 i 100 i++ i++ i {
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    } {
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    } jou = i jou i int aa = 0; aa 0 while(jou <= x){
        jou *= i;
        aa++;
      } jou <= x jou x {
        jou *= i;
        aa++;
      } jou *= i jou i aa++ aa if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      } aa>1 aa 1 {
        jou /= i;
        max = Math.max(max,jou);
      } jou /= i jou i max = Math.max(max,jou) max Math.max(max,jou) Math.max Math max jou System.out.println(max) System.out.println System.out System System.out max String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    if(x ==1){
      System.out.println(1);
      return;
    }
    int jou;
    int max = -1;
    for(int i = 2;i<=100;i++){
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    }
    System.out.println(max);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    if(x ==1){
      System.out.println(1);
      return;
    }
    int jou;
    int max = -1;
    for(int i = 2;i<=100;i++){
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    }
    System.out.println(max);
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    if(x ==1){
      System.out.println(1);
      return;
    }
    int jou;
    int max = -1;
    for(int i = 2;i<=100;i++){
      jou = i;
      int aa = 0;
      while(jou <= x){
        jou *= i;
        aa++;
      }
      if(aa>1){
        jou /= i;
        max = Math.max(max,jou);
      }

    }
    System.out.println(max);
  }
}
