import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[1000];
        a[0] = 1;
        for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        }

        Arrays.sort(a);
        System.out.print(a[999]);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[1000];
        a[0] = 1;
        for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        }

        Arrays.sort(a);
        System.out.print(a[999]);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[1000];
        a[0] = 1;
        for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        }

        Arrays.sort(a);
        System.out.print(a[999]);
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[1000];
        a[0] = 1;
        for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        }

        Arrays.sort(a);
        System.out.print(a[999]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[1000]; a new int[1000] 1000 a[0] = 1 a[0] a 0 1 for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        } int i = 2; int i = 2; i 2 i < n i n i++ i++ i {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        } {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        } int max = i * i; max i * i i i if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            } max <= n max n {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            } do {
                    max *= i;
                } while (max <= n); max <= n max n {
                    max *= i;
                } max *= i max i max /= i max i a[i-1] = max a[i-1] a i-1 i 1 max Arrays.sort(a) Arrays.sort Arrays a System.out.print(a[999]) System.out.print System.out System System.out a[999] a 999 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[1000];
        a[0] = 1;
        for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        }

        Arrays.sort(a);
        System.out.print(a[999]);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[1000];
        a[0] = 1;
        for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        }

        Arrays.sort(a);
        System.out.print(a[999]);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[1000];
        a[0] = 1;
        for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        }

        Arrays.sort(a);
        System.out.print(a[999]);
    }
}
