import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int ans = 0;
		for(int i = 2 ; i <= x ;  i++) {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		}
		if(ans == 0) {
			System.out.println(1);
		} else {
			System.out.println(ans);
		}
	}
} 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();
		int ans = 0;
		for(int i = 2 ; i <= x ;  i++) {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		}
		if(ans == 0) {
			System.out.println(1);
		} else {
			System.out.println(ans);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int ans = 0;
		for(int i = 2 ; i <= x ;  i++) {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		}
		if(ans == 0) {
			System.out.println(1);
		} else {
			System.out.println(ans);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int ans = 0;
		for(int i = 2 ; i <= x ;  i++) {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		}
		if(ans == 0) {
			System.out.println(1);
		} else {
			System.out.println(ans);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int i = 2 ; i <= x ;  i++) {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		} int i = 2 ; int i = 2 ; i 2 i <= x i x i++ i++ i {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		} {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		} for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			} int j = 2 ; int j = 2 ; j 2 (int)Math.pow(i, j) <= x (int)Math.pow(i, j) Math.pow Math i j x j++ j++ j {
				ans = Math.max(ans, (int)Math.pow(i, j));
			} {
				ans = Math.max(ans, (int)Math.pow(i, j));
			} ans = Math.max(ans, (int)Math.pow(i, j)) ans Math.max(ans, (int)Math.pow(i, j)) Math.max Math ans (int)Math.pow(i, j) Math.pow Math i j if(ans == 0) {
			System.out.println(1);
		} else {
			System.out.println(ans);
		} ans == 0 ans 0 {
			System.out.println(1);
		} System.out.println(1) System.out.println System.out System System.out 1 {
			System.out.println(ans);
		} 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 x = sc.nextInt();
		int ans = 0;
		for(int i = 2 ; i <= x ;  i++) {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		}
		if(ans == 0) {
			System.out.println(1);
		} else {
			System.out.println(ans);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int ans = 0;
		for(int i = 2 ; i <= x ;  i++) {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		}
		if(ans == 0) {
			System.out.println(1);
		} else {
			System.out.println(ans);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int ans = 0;
		for(int i = 2 ; i <= x ;  i++) {
			for(int j = 2 ; (int)Math.pow(i, j) <= x ; j++) {
				ans = Math.max(ans, (int)Math.pow(i, j));
			}
		}
		if(ans == 0) {
			System.out.println(1);
		} else {
			System.out.println(ans);
		}
	}
}
