import java.util.Scanner;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int x =scn.nextInt();
        int answer = 0;
        if(x!=1){
            for(int i=2;i<x;i++){
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            }
    }else{
        answer = 1;
    }
        System.out.println(answer);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int x =scn.nextInt();
        int answer = 0;
        if(x!=1){
            for(int i=2;i<x;i++){
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            }
    }else{
        answer = 1;
    }
        System.out.println(answer);
    }
} Main public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int x =scn.nextInt();
        int answer = 0;
        if(x!=1){
            for(int i=2;i<x;i++){
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            }
    }else{
        answer = 1;
    }
        System.out.println(answer);
    } main {
        Scanner scn=new Scanner(System.in);
        int x =scn.nextInt();
        int answer = 0;
        if(x!=1){
            for(int i=2;i<x;i++){
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            }
    }else{
        answer = 1;
    }
        System.out.println(answer);
    } Scanner scn=new Scanner(System.in); scn new Scanner(System.in) int x =scn.nextInt(); x scn.nextInt() scn.nextInt scn int answer = 0; answer 0 if(x!=1){
            for(int i=2;i<x;i++){
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            }
    }else{
        answer = 1;
    } x!=1 x 1 {
            for(int i=2;i<x;i++){
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            }
    } for(int i=2;i<x;i++){
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            } int i=2; int i=2; i 2 i<x i x i++ i++ i {
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            } {
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            } for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                } int j=2; int j=2; j 2 j++ j++ j {
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                } {
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                } double buf = Math.pow(i,j); buf Math.pow(i,j) Math.pow Math i j if(x<buf) break; x<buf x buf break; if(answer<buf) answer =(int) buf; answer<buf answer buf answer =(int) buf answer (int) buf {
        answer = 1;
    } answer = 1 answer 1 System.out.println(answer) System.out.println System.out System System.out answer String arg[] arg
import java.util.Scanner;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int x =scn.nextInt();
        int answer = 0;
        if(x!=1){
            for(int i=2;i<x;i++){
                for(int j=2;;j++){
                    double buf = Math.pow(i,j);
                    if(x<buf) break;
                    if(answer<buf) answer =(int) buf;
                }
            }
    }else{
        answer = 1;
    }
        System.out.println(answer);
    }
}