import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        double ans = 1; 
        for(int i = 2; i < x ; i++){
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        }
        System.out.println((int)ans);
    }
} 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);
        int x = sc.nextInt();
        double ans = 1; 
        for(int i = 2; i < x ; i++){
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        }
        System.out.println((int)ans);
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        double ans = 1; 
        for(int i = 2; i < x ; i++){
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        }
        System.out.println((int)ans);
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        double ans = 1; 
        for(int i = 2; i < x ; i++){
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        }
        System.out.println((int)ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc double ans = 1; ans 1 for(int i = 2; i < x ; i++){
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        } int i = 2; int i = 2; i 2 i < x i x i++ i++ i {
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        } {
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        } if(x == 1){
                break;
            } x == 1 x 1 {
                break;
            } break; for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            } int j = 2; int j = 2; j 2 Math.pow(i,j) <= x Math.pow(i,j) Math.pow Math i j x j++ j++ j {
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            } {
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            } if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                } Math.pow(i,j) > ans Math.pow(i,j) Math.pow Math i j ans {
                    ans = Math.pow(i,j);
                } ans = Math.pow(i,j) ans Math.pow(i,j) Math.pow Math i j System.out.println((int)ans) System.out.println System.out System System.out (int)ans String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        double ans = 1; 
        for(int i = 2; i < x ; i++){
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        }
        System.out.println((int)ans);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        double ans = 1; 
        for(int i = 2; i < x ; i++){
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        }
        System.out.println((int)ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        double ans = 1; 
        for(int i = 2; i < x ; i++){
            if(x == 1){
                break;
            }
            for(int j = 2; Math.pow(i,j) <= x; j++){
                if(Math.pow(i,j) > ans){
                    ans = Math.pow(i,j);
                }    
            }
        }
        System.out.println((int)ans);
    }
}
