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

		int max = 0;
		if(x == 1) {
			max = 1;
		} else if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		}
		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 x = sc.nextInt();

		int max = 0;
		if(x == 1) {
			max = 1;
		} else if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		}
		System.out.println(max);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();

		int max = 0;
		if(x == 1) {
			max = 1;
		} else if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		}
		System.out.println(max);
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();

		int max = 0;
		if(x == 1) {
			max = 1;
		} else if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		}
		System.out.println(max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int max = 0; max 0 if(x == 1) {
			max = 1;
		} else if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		} x == 1 x 1 {
			max = 1;
		} max = 1 max 1 if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		} x == 2 x 2 {
			max = 2;
		} max = 2 max 2 {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		} int maxnum = (int)Math.sqrt(x); maxnum (int)Math.sqrt(x) Math.sqrt Math x for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			} int i = 2; int i = 2; i 2 i <= maxnum i maxnum i++ i++ i {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			} {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			} int tmp = i; tmp i while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				} true {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				} tmp =  tmp * i tmp tmp * i tmp i if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					} tmp > x tmp x {
						max = Math.max(max, tmp/i);
						break;
					} max = Math.max(max, tmp/i) max Math.max(max, tmp/i) Math.max Math max tmp/i tmp i break; 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 x = sc.nextInt();

		int max = 0;
		if(x == 1) {
			max = 1;
		} else if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		}
		System.out.println(max);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();

		int max = 0;
		if(x == 1) {
			max = 1;
		} else if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		}
		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 x = sc.nextInt();

		int max = 0;
		if(x == 1) {
			max = 1;
		} else if(x == 2) {
			max = 2;
		} else {
			int maxnum = (int)Math.sqrt(x);
			for(int i = 2; i <= maxnum; i++) {
				int tmp = i;
				while(true) {
					tmp =  tmp * i;
					if(tmp > x) {
						max = Math.max(max, tmp/i);
						break;
					}
				}
			}
		}
		System.out.println(max);
	}
}
