import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

  		int num = sc.nextInt(); 
      	int stack;
      	int ans = 1;
      	
      	for(int i = 2; i <= 32; i++){
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        }
      	
      	System.out.println(ans);
        
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

  		int num = sc.nextInt(); 
      	int stack;
      	int ans = 1;
      	
      	for(int i = 2; i <= 32; i++){
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        }
      	
      	System.out.println(ans);
        
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

  		int num = sc.nextInt(); 
      	int stack;
      	int ans = 1;
      	
      	for(int i = 2; i <= 32; i++){
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        }
      	
      	System.out.println(ans);
        
	} main {
		Scanner sc = new Scanner(System.in);

  		int num = sc.nextInt(); 
      	int stack;
      	int ans = 1;
      	
      	for(int i = 2; i <= 32; i++){
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        }
      	
      	System.out.println(ans);
        
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int stack; stack int ans = 1; ans 1 for(int i = 2; i <= 32; i++){
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        } int i = 2; int i = 2; i 2 i <= 32 i 32 i++ i++ i {
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        } {
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        } stack  = i stack i while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            } stack*i <= num stack*i stack i num {
              stack *= i;
          	  if(stack > ans) ans = stack;
            } stack *= i stack i if(stack > ans) ans = stack; stack > ans stack ans ans = stack ans stack 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);

  		int num = sc.nextInt(); 
      	int stack;
      	int ans = 1;
      	
      	for(int i = 2; i <= 32; i++){
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        }
      	
      	System.out.println(ans);
        
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

  		int num = sc.nextInt(); 
      	int stack;
      	int ans = 1;
      	
      	for(int i = 2; i <= 32; i++){
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        }
      	
      	System.out.println(ans);
        
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

  		int num = sc.nextInt(); 
      	int stack;
      	int ans = 1;
      	
      	for(int i = 2; i <= 32; i++){
          	stack  = i;
        	while(stack*i <= num) {
              stack *= i;
          	  if(stack > ans) ans = stack;
            }
        }
      	
      	System.out.println(ans);
        
	}
}
