import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        }
    }
} Main public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        }
    } try (Scanner in = new Scanner(System.in)) {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        } {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) int X = in.nextInt(); X in.nextInt() in.nextInt in int max = 0; max 0 for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            } int b = 1; int b = 1; b 1 b <= X b X b++ b++ b {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            } {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            } if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                } b > 1 b 1 {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    } int p = 2; int p = 2; p 2 p++ p++ p {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    } {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    } int n = (int) (1e-9 + Math.pow(b, p)); n (int) (1e-9 + Math.pow(b, p)) 1e-9 Math.pow(b, p) Math.pow Math b p if (n > X) {
                            break;
                        } n > X n X {
                            break;
                        } break; max = Math.max(max, n) max Math.max(max, n) Math.max Math max n {
                    int n = b;
                    max = Math.max(max, n);
                } int n = b; n b max = Math.max(max, n) max Math.max(max, n) Math.max Math max n 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[]) {
        try (Scanner in = new Scanner(System.in)) {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        }
    }
} public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int X = in.nextInt();
            int max = 0;
            for (int b = 1; b <= X; b++) {
                if (b > 1) {
                    for (int p = 2;; p++) {
                        int n = (int) (1e-9 + Math.pow(b, p));
                        if (n > X) {
                            break;
                        }
                        max = Math.max(max, n);
                    }
                } else {
                    int n = b;
                    max = Math.max(max, n);
                }
            }
            System.out.println(max);
        }
    }
}
