import java.util.Scanner;

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

        double X = scanner.nextDouble();

        double doubleSqrt = Math.sqrt(X);
        int sqrt = (int) Math.floor(doubleSqrt);

        int ans = 1;

        if (sqrt<2){
            System.out.println(ans);
            return;
        }

        for (int i = 2; i <= sqrt; i++) {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        }
        System.out.println(ans);

        scanner.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        double X = scanner.nextDouble();

        double doubleSqrt = Math.sqrt(X);
        int sqrt = (int) Math.floor(doubleSqrt);

        int ans = 1;

        if (sqrt<2){
            System.out.println(ans);
            return;
        }

        for (int i = 2; i <= sqrt; i++) {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        }
        System.out.println(ans);

        scanner.close();
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        double X = scanner.nextDouble();

        double doubleSqrt = Math.sqrt(X);
        int sqrt = (int) Math.floor(doubleSqrt);

        int ans = 1;

        if (sqrt<2){
            System.out.println(ans);
            return;
        }

        for (int i = 2; i <= sqrt; i++) {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        }
        System.out.println(ans);

        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);

        double X = scanner.nextDouble();

        double doubleSqrt = Math.sqrt(X);
        int sqrt = (int) Math.floor(doubleSqrt);

        int ans = 1;

        if (sqrt<2){
            System.out.println(ans);
            return;
        }

        for (int i = 2; i <= sqrt; i++) {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        }
        System.out.println(ans);

        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) double X = scanner.nextDouble(); X scanner.nextDouble() scanner.nextDouble scanner double doubleSqrt = Math.sqrt(X); doubleSqrt Math.sqrt(X) Math.sqrt Math X int sqrt = (int) Math.floor(doubleSqrt); sqrt (int) Math.floor(doubleSqrt) Math.floor Math doubleSqrt int ans = 1; ans 1 if (sqrt<2){
            System.out.println(ans);
            return;
        } sqrt<2 sqrt 2 {
            System.out.println(ans);
            return;
        } System.out.println(ans) System.out.println System.out System System.out ans return; for (int i = 2; i <= sqrt; i++) {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        } int i = 2; int i = 2; i 2 i <= sqrt i sqrt i++ i++ i {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        } {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        } int accum = i; accum i while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            } true {
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            } accum*=i accum i if (accum>X){
                    break;
                } accum>X accum X {
                    break;
                } break; if (ans<accum) ans = accum; ans<accum ans accum ans = accum ans accum System.out.println(ans) System.out.println System.out System System.out ans scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        double X = scanner.nextDouble();

        double doubleSqrt = Math.sqrt(X);
        int sqrt = (int) Math.floor(doubleSqrt);

        int ans = 1;

        if (sqrt<2){
            System.out.println(ans);
            return;
        }

        for (int i = 2; i <= sqrt; i++) {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        }
        System.out.println(ans);

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

        double X = scanner.nextDouble();

        double doubleSqrt = Math.sqrt(X);
        int sqrt = (int) Math.floor(doubleSqrt);

        int ans = 1;

        if (sqrt<2){
            System.out.println(ans);
            return;
        }

        for (int i = 2; i <= sqrt; i++) {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        }
        System.out.println(ans);

        scanner.close();
    }
} Main
import java.util.Scanner;

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

        double X = scanner.nextDouble();

        double doubleSqrt = Math.sqrt(X);
        int sqrt = (int) Math.floor(doubleSqrt);

        int ans = 1;

        if (sqrt<2){
            System.out.println(ans);
            return;
        }

        for (int i = 2; i <= sqrt; i++) {
            int accum = i;
            while (true){
                accum*=i;
                if (accum>X){
                    break;
                }
                if (ans<accum) ans = accum;
            }
        }
        System.out.println(ans);

        scanner.close();
    }
}
