import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x;
		x = sc.nextInt();

		if(x == 1) {
			System.out.println(1);
			return;
		}

		int ans = 0;
		for (int b = 2; b <= 1000; b++) {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		}

		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;
		x = sc.nextInt();

		if(x == 1) {
			System.out.println(1);
			return;
		}

		int ans = 0;
		for (int b = 2; b <= 1000; b++) {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		}

		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x;
		x = sc.nextInt();

		if(x == 1) {
			System.out.println(1);
			return;
		}

		int ans = 0;
		for (int b = 2; b <= 1000; b++) {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		}

		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int x;
		x = sc.nextInt();

		if(x == 1) {
			System.out.println(1);
			return;
		}

		int ans = 0;
		for (int b = 2; b <= 1000; b++) {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		}

		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x; x x = sc.nextInt() x sc.nextInt() sc.nextInt sc 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 ans = 0; ans 0 for (int b = 2; b <= 1000; b++) {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		} int b = 2; int b = 2; b 2 b <= 1000 b 1000 b++ b++ b {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		} {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		} int p = 2; p 2 while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			} Math.pow(b, p) <= x Math.pow(b, p) Math.pow Math b p x {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			} int num = (int)Math.pow(b, p); num (int)Math.pow(b, p) Math.pow Math b p p++ p ans = Math.max(ans, num) ans Math.max(ans, num) Math.max Math ans num 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;
		x = sc.nextInt();

		if(x == 1) {
			System.out.println(1);
			return;
		}

		int ans = 0;
		for (int b = 2; b <= 1000; b++) {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		}

		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x;
		x = sc.nextInt();

		if(x == 1) {
			System.out.println(1);
			return;
		}

		int ans = 0;
		for (int b = 2; b <= 1000; b++) {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		}

		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;
		x = sc.nextInt();

		if(x == 1) {
			System.out.println(1);
			return;
		}

		int ans = 0;
		for (int b = 2; b <= 1000; b++) {
			int p = 2;
			while(Math.pow(b, p) <= x) {
				int num = (int)Math.pow(b, p);
				p++;
				ans = Math.max(ans, num);
			}
		}

		System.out.println(ans);
	}
}