import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int X = scanner.nextInt();
		int table[] = new int[X + 1];

		int Max = 1;
		for (int i = 2; i < Math.sqrt(X); i++) {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		}
		System.out.println(Max);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int X = scanner.nextInt();
		int table[] = new int[X + 1];

		int Max = 1;
		for (int i = 2; i < Math.sqrt(X); i++) {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		}
		System.out.println(Max);
	}

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int X = scanner.nextInt();
		int table[] = new int[X + 1];

		int Max = 1;
		for (int i = 2; i < Math.sqrt(X); i++) {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		}
		System.out.println(Max);
	} main {
		Scanner scanner = new Scanner(System.in);
		int X = scanner.nextInt();
		int table[] = new int[X + 1];

		int Max = 1;
		for (int i = 2; i < Math.sqrt(X); i++) {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		}
		System.out.println(Max);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int X = scanner.nextInt(); X scanner.nextInt() scanner.nextInt scanner int table[] = new int[X + 1]; table new int[X + 1] X + 1 X 1 int Max = 1; Max 1 for (int i = 2; i < Math.sqrt(X); i++) {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		} int i = 2; int i = 2; i 2 i < Math.sqrt(X) i Math.sqrt(X) Math.sqrt Math X i++ i++ i {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		} {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		} int p = 2; p 2 int tmp; tmp while ((int) Math.pow(i, p) <= X) {
				p++;
			} (int) Math.pow(i, p) <= X (int) Math.pow(i, p) Math.pow Math i p X {
				p++;
			} p++ p Max = Math.max(Max, (int) Math.pow(i, p - 1)) Max Math.max(Max, (int) Math.pow(i, p - 1)) Math.max Math Max (int) Math.pow(i, p - 1) Math.pow Math i p - 1 p 1 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 scanner = new Scanner(System.in);
		int X = scanner.nextInt();
		int table[] = new int[X + 1];

		int Max = 1;
		for (int i = 2; i < Math.sqrt(X); i++) {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		}
		System.out.println(Max);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int X = scanner.nextInt();
		int table[] = new int[X + 1];

		int Max = 1;
		for (int i = 2; i < Math.sqrt(X); i++) {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		}
		System.out.println(Max);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int X = scanner.nextInt();
		int table[] = new int[X + 1];

		int Max = 1;
		for (int i = 2; i < Math.sqrt(X); i++) {
			int p = 2;
			int tmp;
			while ((int) Math.pow(i, p) <= X) {
				p++;
			}
			Max = Math.max(Max, (int) Math.pow(i, p - 1));
		}
		System.out.println(Max);
	}

}
