import java.util.Scanner;

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

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