import java.util.*;

public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = 0;
    int ans = 0;
    
    if(N<4){
        ans = 1;
    }else{
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    }
    System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = 0;
    int ans = 0;
    
    if(N<4){
        ans = 1;
    }else{
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    }
    System.out.println(ans);
    }
} Main public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = 0;
    int ans = 0;
    
    if(N<4){
        ans = 1;
    }else{
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    }
    System.out.println(ans);
    } main {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = 0;
    int ans = 0;
    
    if(N<4){
        ans = 1;
    }else{
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    }
    System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = 0; M 0 int ans = 0; ans 0 if(N<4){
        ans = 1;
    }else{
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    } N<4 N 4 {
        ans = 1;
    } ans = 1 ans 1 {
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    } for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    } int i=2; int i=2; i 2 i<=N i N i++ i++ i {
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    } {
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    } M = 0 M 0 for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        } int j=2; int j=2; j 2 M<=N M N j++ j++ j {
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        } {
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        } if(ans < M){
                ans = M;
            } ans < M ans M {
                ans = M;
            } ans = M ans M M = (int)Math.pow(i,j) M (int)Math.pow(i,j) Math.pow Math i j System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = 0;
    int ans = 0;
    
    if(N<4){
        ans = 1;
    }else{
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    }
    System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = 0;
    int ans = 0;
    
    if(N<4){
        ans = 1;
    }else{
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    }
    System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = 0;
    int ans = 0;
    
    if(N<4){
        ans = 1;
    }else{
    for(int i=2; i<=N; i++){
        M = 0;
        for(int j=2; M<=N; j++){
                        if(ans < M){
                ans = M;
            }
            M = (int)Math.pow(i,j);

        }
    }  
    }
    System.out.println(ans);
    }
}