import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 1;
        if (n < 4) {
            max = 1;
        } else {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        }
        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 n = sc.nextInt();
        int max = 1;
        if (n < 4) {
            max = 1;
        } else {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        }
        System.out.println(max);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 1;
        if (n < 4) {
            max = 1;
        } else {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        }
        System.out.println(max);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 1;
        if (n < 4) {
            max = 1;
        } else {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        }
        System.out.println(max);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int max = 1; max 1 if (n < 4) {
            max = 1;
        } else {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        } n < 4 n 4 {
            max = 1;
        } max = 1 max 1 {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        } for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            } int i = 2; int i = 2; i 2 i < 34 i 34 i++ i++ i {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            } {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            } int b = 2; b 2 while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                } Math.pow(i, b) <= n Math.pow(i, b) Math.pow Math i b n {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                } if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    } max < (int) Math.pow(i, b) max (int) Math.pow(i, b) Math.pow Math i b {
                        max = (int) Math.pow(i, b);
                    } max = (int) Math.pow(i, b) max (int) Math.pow(i, b) Math.pow Math i b b++ b 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 n = sc.nextInt();
        int max = 1;
        if (n < 4) {
            max = 1;
        } else {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        }
        System.out.println(max);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 1;
        if (n < 4) {
            max = 1;
        } else {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        }
        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 n = sc.nextInt();
        int max = 1;
        if (n < 4) {
            max = 1;
        } else {
            for (int i = 2; i < 34; i++) {
                int b = 2;
                while (Math.pow(i, b) <= n) {
                    if (max < (int) Math.pow(i, b)) {
                        max = (int) Math.pow(i, b);
                    }
                    b++;
                }
            }
        }
        System.out.println(max);
    }
}