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 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } 
  }  
} 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 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } 
  }  
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    
    if(x>=1 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } 
  } main {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    
    if(x>=1 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } 
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc if(x>=1 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } x>=1 && x<=1000 x>=1 x 1 x<=1000 x 1000 {
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    } 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 max = 1; max 1 for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      } int i = 2; int i = 2; i 2 i <= x i x i++ i++ i {
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      } {
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      } for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         } int k = 2; int k = 2; k 2 Math.pow(i,k) <=x Math.pow(i,k) Math.pow Math i k x k++ k++ k {
          max = Math.max(max,(int)Math.pow(i,k));
         } {
          max = Math.max(max,(int)Math.pow(i,k));
         } max = Math.max(max,(int)Math.pow(i,k)) max Math.max(max,(int)Math.pow(i,k)) Math.max Math max (int)Math.pow(i,k) Math.pow Math i k System.out.println(max) System.out.println System.out System System.out max {
      System.out.println("入力条件が誤っています");
    } System.out.println("入力条件が誤っています") System.out.println System.out System System.out "入力条件が誤っています" 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 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } 
  }  
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    
    if(x>=1 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } 
  }  
} 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 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } 
  }  
}