import java.lang.reflect.Array;
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
        } else {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        }

    }
} import java.lang.reflect.Array; Array java.lang.reflect import java.util.*; util.* java import java.lang.*; lang.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
        } else {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        }

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
        } else {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        }

    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
        } else {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc if (x == 1) {
            System.out.println(1);
        } else {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        } x == 1 x 1 {
            System.out.println(1);
        } System.out.println(1) System.out.println System.out System System.out 1 {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        } ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            } int i = 2; int i = 2; i 2 i <= Math.sqrt(x) i Math.sqrt(x) Math.sqrt Math x i++ i++ i {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            } {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            } int max = 0; max 0 for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                } int j = 0; int j = 0; j 0 Math.pow(i, j) <= x Math.pow(i, j) Math.pow Math i j x j++ j++ j {
                    max = (int)Math.pow(i, j);
                } {
                    max = (int)Math.pow(i, j);
                } max = (int)Math.pow(i, j) max (int)Math.pow(i, j) Math.pow Math i j list.add(max) list.add list max Collections.sort(list) Collections.sort Collections list Collections.reverse(list) Collections.reverse Collections list System.out.println(list.get(0)) System.out.println System.out System System.out list.get(0) list.get list 0 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
        } else {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        }

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
        } else {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        }

    }
} Main
import java.lang.reflect.Array;
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if (x == 1) {
            System.out.println(1);
        } else {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 2; i <= Math.sqrt(x); i++) {
                int max = 0;
                for (int j = 0; Math.pow(i, j) <= x; j++) {
                    max = (int)Math.pow(i, j);
                }
                list.add(max);
            }
            Collections.sort(list);
            Collections.reverse(list);
            System.out.println(list.get(0));
        }

    }
}