import java.util.*;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		}
		System.out.println(a);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		}
		System.out.println(a);
	}
} Main public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		}
		System.out.println(a);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		}
		System.out.println(a);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int a = 0; a 0 for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		} int i = 1 ; int i = 1 ; i 1 i <= Math.sqrt(n) i Math.sqrt(n) Math.sqrt Math n i++ i++ i {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		} {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		} for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			} int k = 2 ; int k = 2 ; k 2 Math.pow(i, k) <= n Math.pow(i, k) Math.pow Math i k n k++ k++ k {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			} {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			} int p = (int)Math.pow(i, k); p (int)Math.pow(i, k) Math.pow Math i k if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				} i == 1 i 1 {
					a = 1;
					break;
				} a = 1 a 1 break; if (p <= n && p > a) {
					a = p;
				} p <= n && p > a p <= n p n p > a p a {
					a = p;
				} a = p a p System.out.println(a) System.out.println System.out System System.out a String... args args public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		}
		System.out.println(a);
	}
} public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		}
		System.out.println(a);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		}
		System.out.println(a);
	}
}
