import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Integer> list = new ArrayList<Integer>();
        list.add(1);
        for (int i = 100; i >= 2; i--) {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        }
        list.sort(Comparator.reverseOrder());
        System.out.println(list.get(0));
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Integer> list = new ArrayList<Integer>();
        list.add(1);
        for (int i = 100; i >= 2; i--) {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        }
        list.sort(Comparator.reverseOrder());
        System.out.println(list.get(0));
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Integer> list = new ArrayList<Integer>();
        list.add(1);
        for (int i = 100; i >= 2; i--) {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        }
        list.sort(Comparator.reverseOrder());
        System.out.println(list.get(0));
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Integer> list = new ArrayList<Integer>();
        list.add(1);
        for (int i = 100; i >= 2; i--) {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        }
        list.sort(Comparator.reverseOrder());
        System.out.println(list.get(0));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() list.add(1) list.add list 1 for (int i = 100; i >= 2; i--) {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        } int i = 100; int i = 100; i 100 i >= 2 i 2 i-- i-- i {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        } {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        } int tmp = i * i; tmp i * i i i while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            } tmp <= n tmp n {
                list.add(tmp);
                tmp *= i;
            } list.add(tmp) list.add list tmp tmp *= i tmp i list.sort(Comparator.reverseOrder()) list.sort list Comparator.reverseOrder() Comparator.reverseOrder Comparator 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) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Integer> list = new ArrayList<Integer>();
        list.add(1);
        for (int i = 100; i >= 2; i--) {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        }
        list.sort(Comparator.reverseOrder());
        System.out.println(list.get(0));
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Integer> list = new ArrayList<Integer>();
        list.add(1);
        for (int i = 100; i >= 2; i--) {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        }
        list.sort(Comparator.reverseOrder());
        System.out.println(list.get(0));
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Integer> list = new ArrayList<Integer>();
        list.add(1);
        for (int i = 100; i >= 2; i--) {
            int tmp = i * i;
            while (tmp <= n) {
                list.add(tmp);
                tmp *= i;
            }
        }
        list.sort(Comparator.reverseOrder());
        System.out.println(list.get(0));
    }
}
