import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		double a = Math.sqrt(X);
		long max=1;
		for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		}
		System.out.println(max);
		sc.close();
	}
} 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();
		double a = Math.sqrt(X);
		long max=1;
		for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		}
		System.out.println(max);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		double a = Math.sqrt(X);
		long max=1;
		for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		}
		System.out.println(max);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		double a = Math.sqrt(X);
		long max=1;
		for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		}
		System.out.println(max);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc double a = Math.sqrt(X); a Math.sqrt(X) Math.sqrt Math X long max=1; max 1 for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		} int b =2; int b =2; b 2 b<=X b X b++ b++ b {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		} {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		} for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			} int q =2; int q =2; q 2 Math.pow(b, q)<=X Math.pow(b, q) Math.pow Math b q X q++ q++ q {
					max=Math.max((int)Math.pow(b, q),max);
			} {
					max=Math.max((int)Math.pow(b, q),max);
			} max=Math.max((int)Math.pow(b, q),max) max Math.max((int)Math.pow(b, q),max) Math.max Math (int)Math.pow(b, q) Math.pow Math b q max System.out.println(max) System.out.println System.out System System.out max sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		double a = Math.sqrt(X);
		long max=1;
		for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		}
		System.out.println(max);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		double a = Math.sqrt(X);
		long max=1;
		for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		}
		System.out.println(max);
		sc.close();
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		double a = Math.sqrt(X);
		long max=1;
		for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		}
		System.out.println(max);
		sc.close();
	}
}
