import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int X = sc.nextInt();
		  sc.close();
		  
		  if(X == 1) {
			  System.out.println("1");
		      System.exit(0);
		  }
		  
		  int answer = 1;
		  
		  for(int base = 2; base <= Math.sqrt(X); base++) {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  }
		 
		  System.out.println(answer);
	      System.exit(0);
	    }
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int X = sc.nextInt();
		  sc.close();
		  
		  if(X == 1) {
			  System.out.println("1");
		      System.exit(0);
		  }
		  
		  int answer = 1;
		  
		  for(int base = 2; base <= Math.sqrt(X); base++) {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  }
		 
		  System.out.println(answer);
	      System.exit(0);
	    }
} Main public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int X = sc.nextInt();
		  sc.close();
		  
		  if(X == 1) {
			  System.out.println("1");
		      System.exit(0);
		  }
		  
		  int answer = 1;
		  
		  for(int base = 2; base <= Math.sqrt(X); base++) {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  }
		 
		  System.out.println(answer);
	      System.exit(0);
	    } main {
		  Scanner sc = new Scanner(System.in);
		  int X = sc.nextInt();
		  sc.close();
		  
		  if(X == 1) {
			  System.out.println("1");
		      System.exit(0);
		  }
		  
		  int answer = 1;
		  
		  for(int base = 2; base <= Math.sqrt(X); base++) {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  }
		 
		  System.out.println(answer);
	      System.exit(0);
	    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc sc.close() sc.close sc if(X == 1) {
			  System.out.println("1");
		      System.exit(0);
		  } X == 1 X 1 {
			  System.out.println("1");
		      System.exit(0);
		  } System.out.println("1") System.out.println System.out System System.out "1" System.exit(0) System.exit System 0 int answer = 1; answer 1 for(int base = 2; base <= Math.sqrt(X); base++) {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  } int base = 2; int base = 2; base 2 base <= Math.sqrt(X) base Math.sqrt(X) Math.sqrt Math X base++ base++ base {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  } {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  } int i = 2; i 2 while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  } Math.pow(base, i) <= X Math.pow(base, i) Math.pow Math base i X {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  } answer = Math.max(answer, (int)Math.pow(base, i)) answer Math.max(answer, (int)Math.pow(base, i)) Math.max Math answer (int)Math.pow(base, i) Math.pow Math base i i++ i System.out.println(answer) System.out.println System.out System System.out answer System.exit(0) System.exit System 0 String[] args args public class Main {

	public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int X = sc.nextInt();
		  sc.close();
		  
		  if(X == 1) {
			  System.out.println("1");
		      System.exit(0);
		  }
		  
		  int answer = 1;
		  
		  for(int base = 2; base <= Math.sqrt(X); base++) {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  }
		 
		  System.out.println(answer);
	      System.exit(0);
	    }
} public class Main {

	public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int X = sc.nextInt();
		  sc.close();
		  
		  if(X == 1) {
			  System.out.println("1");
		      System.exit(0);
		  }
		  
		  int answer = 1;
		  
		  for(int base = 2; base <= Math.sqrt(X); base++) {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  }
		 
		  System.out.println(answer);
	      System.exit(0);
	    }
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int X = sc.nextInt();
		  sc.close();
		  
		  if(X == 1) {
			  System.out.println("1");
		      System.exit(0);
		  }
		  
		  int answer = 1;
		  
		  for(int base = 2; base <= Math.sqrt(X); base++) {
			  int i = 2;
			  while(Math.pow(base, i) <= X) {
				  answer = Math.max(answer, (int)Math.pow(base, i));
				  i++;
			  }
		  }
		 
		  System.out.println(answer);
	      System.exit(0);
	    }
}