

import java.util.Scanner;

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

		int max = 1;
		for (int b = 1; b < i + 1; b++) {
			for (int p = 2; p <11 ; p++) {
				if ((Math.pow(b, p) <= i)) {
					if (max < Math.pow(b, p)) {
						max = (int) Math.pow(b, p);
					}
				}
			}
		}
		System.out.println(max);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();

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

		int max = 1;
		for (int b = 1; b < i + 1; b++) {
			for (int p = 2; p <11 ; p++) {
				if ((Math.pow(b, p) <= i)) {
					if (max < Math.pow(b, p)) {
						max = (int) Math.pow(b, p);
					}
				}
			}
		}
		System.out.println(max);
	} main {
		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();

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

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

		int max = 1;
		for (int b = 1; b < i + 1; b++) {
			for (int p = 2; p <11 ; p++) {
				if ((Math.pow(b, p) <= i)) {
					if (max < Math.pow(b, p)) {
						max = (int) Math.pow(b, p);
					}
				}
			}
		}
		System.out.println(max);
	}
} Main


import java.util.Scanner;

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

		int max = 1;
		for (int b = 1; b < i + 1; b++) {
			for (int p = 2; p <11 ; p++) {
				if ((Math.pow(b, p) <= i)) {
					if (max < Math.pow(b, p)) {
						max = (int) Math.pow(b, p);
					}
				}
			}
		}
		System.out.println(max);
	}
}
