import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner scan=new Scanner(System.in);
        int X=scan.nextInt();
        int max=1;
        int i,j;
        for(i=2;i<=Math.sqrt(X);i++){
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        }
        System.out.println(max);

    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String args[]){
        Scanner scan=new Scanner(System.in);
        int X=scan.nextInt();
        int max=1;
        int i,j;
        for(i=2;i<=Math.sqrt(X);i++){
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        }
        System.out.println(max);

    }
} Main public static void main(String args[]){
        Scanner scan=new Scanner(System.in);
        int X=scan.nextInt();
        int max=1;
        int i,j;
        for(i=2;i<=Math.sqrt(X);i++){
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        }
        System.out.println(max);

    } main {
        Scanner scan=new Scanner(System.in);
        int X=scan.nextInt();
        int max=1;
        int i,j;
        for(i=2;i<=Math.sqrt(X);i++){
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        }
        System.out.println(max);

    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int X=scan.nextInt(); X scan.nextInt() scan.nextInt scan int max=1; max 1 int i i j; j for(i=2;i<=Math.sqrt(X);i++){
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        } i=2; i=2 i 2 i<=Math.sqrt(X) i Math.sqrt(X) Math.sqrt Math X i++ i++ i {
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        } {
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        } j=i j i while(j*i<=X){
                j*=i;
            } j*i<=X j*i j i X {
                j*=i;
            } j*=i j i if(max<j){
                max=j;
            } max<j max j {
                max=j;
            } max=j max j 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 scan=new Scanner(System.in);
        int X=scan.nextInt();
        int max=1;
        int i,j;
        for(i=2;i<=Math.sqrt(X);i++){
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        }
        System.out.println(max);

    }
} public class Main{
    public static void main(String args[]){
        Scanner scan=new Scanner(System.in);
        int X=scan.nextInt();
        int max=1;
        int i,j;
        for(i=2;i<=Math.sqrt(X);i++){
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        }
        System.out.println(max);

    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner scan=new Scanner(System.in);
        int X=scan.nextInt();
        int max=1;
        int i,j;
        for(i=2;i<=Math.sqrt(X);i++){
            j=i;
            while(j*i<=X){
                j*=i;
            }
            if(max<j){
                max=j;
            }
        }
        System.out.println(max);

    }
}