import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int x = sc.nextInt();
		int max = 1;
		for (int i = 2; i * i <= x; i++) {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		}
		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);
		StringBuilder sb = new StringBuilder();
		int x = sc.nextInt();
		int max = 1;
		for (int i = 2; i * i <= x; i++) {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		}
		System.out.println(max);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int x = sc.nextInt();
		int max = 1;
		for (int i = 2; i * i <= x; i++) {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		}
		System.out.println(max);
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int x = sc.nextInt();
		int max = 1;
		for (int i = 2; i * i <= x; i++) {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		}
		System.out.println(max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int max = 1; max 1 for (int i = 2; i * i <= x; i++) {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		} int i = 2; int i = 2; i 2 i * i <= x i * i i i x i++ i++ i {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		} {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		} int t = i; t i while (t <= x) {
				t = t * i;
			} t <= x t x {
				t = t * i;
			} t = t * i t t * i t i max = Math.max(max, t / i) max Math.max(max, t / i) Math.max Math max t / i t i 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);
		StringBuilder sb = new StringBuilder();
		int x = sc.nextInt();
		int max = 1;
		for (int i = 2; i * i <= x; i++) {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		}
		System.out.println(max);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int x = sc.nextInt();
		int max = 1;
		for (int i = 2; i * i <= x; i++) {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		}
		System.out.println(max);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int x = sc.nextInt();
		int max = 1;
		for (int i = 2; i * i <= x; i++) {
			int t = i;
			while (t <= x) {
				t = t * i;
			}
			max = Math.max(max, t / i);
		}
		System.out.println(max);
	}
}
