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 = 1;
        for (int i = 2; i <= 1000; i++) {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        }

        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 = 1;
        for (int i = 2; i <= 1000; i++) {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        }

        System.out.println(max);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();

        int max = 1;
        for (int i = 2; i <= 1000; i++) {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        }

        System.out.println(max);
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();

        int max = 1;
        for (int i = 2; i <= 1000; i++) {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        }

        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 = 1; max 1 for (int i = 2; i <= 1000; i++) {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        } int i = 2; int i = 2; i 2 i <= 1000 i 1000 i++ i++ i {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        } {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        } int e = i; e i while (e <= x) {
                e *= i;
            } e <= x e x {
                e *= i;
            } e *= i e i if (e / i != i) {
                max = Math.max(e / i, max);
            } e / i != i e / i e i i {
                max = Math.max(e / i, max);
            } max = Math.max(e / i, max) max Math.max(e / i, max) Math.max Math e / i e i max 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 = 1;
        for (int i = 2; i <= 1000; i++) {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        }

        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 = 1;
        for (int i = 2; i <= 1000; i++) {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        }

        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 = 1;
        for (int i = 2; i <= 1000; i++) {
            int e = i;
            while (e <= x) {
                e *= i;
            }

            if (e / i != i) {
                max = Math.max(e / i, max);
            }
        }

        System.out.println(max);
    }
}
