import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        TreeSet<Integer> set = new TreeSet<>();
        set.add(1);
        for(int i = 2 ; i <= Math.sqrt(n) ; i++){
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        }
        System.out.println(set.last());

    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        TreeSet<Integer> set = new TreeSet<>();
        set.add(1);
        for(int i = 2 ; i <= Math.sqrt(n) ; i++){
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        }
        System.out.println(set.last());

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        TreeSet<Integer> set = new TreeSet<>();
        set.add(1);
        for(int i = 2 ; i <= Math.sqrt(n) ; i++){
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        }
        System.out.println(set.last());

    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        TreeSet<Integer> set = new TreeSet<>();
        set.add(1);
        for(int i = 2 ; i <= Math.sqrt(n) ; i++){
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        }
        System.out.println(set.last());

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc TreeSet<Integer> set = new TreeSet<>(); set new TreeSet<>() set.add(1) set.add set 1 for(int i = 2 ; i <= Math.sqrt(n) ; i++){
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        } int i = 2 ; int i = 2 ; i 2 i <= Math.sqrt(n) i Math.sqrt(n) Math.sqrt Math n i++ i++ i {
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        } {
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        } for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            } int j = i*i ; int j = i*i ; j i*i i i j <= n j n j*=i j*=i j i {
                set.add(j);
            } {
                set.add(j);
            } set.add(j) set.add set j System.out.println(set.last()) System.out.println System.out System System.out set.last() set.last set String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        TreeSet<Integer> set = new TreeSet<>();
        set.add(1);
        for(int i = 2 ; i <= Math.sqrt(n) ; i++){
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        }
        System.out.println(set.last());

    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        TreeSet<Integer> set = new TreeSet<>();
        set.add(1);
        for(int i = 2 ; i <= Math.sqrt(n) ; i++){
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        }
        System.out.println(set.last());

    }
} Main
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        TreeSet<Integer> set = new TreeSet<>();
        set.add(1);
        for(int i = 2 ; i <= Math.sqrt(n) ; i++){
            for(int j = i*i ; j <= n; j*=i){
                set.add(j);
            }
        }
        System.out.println(set.last());

    }
}