
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        
        int p = 2;
        int q = 1;
        double num1 = 1;
        double num2 = 1;
        double power = Math.pow(p, q);
        
        for(p = 2; Math.pow(p, q) <= X; p++){
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        }
        System.out.println((int)num2);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        
        int p = 2;
        int q = 1;
        double num1 = 1;
        double num2 = 1;
        double power = Math.pow(p, q);
        
        for(p = 2; Math.pow(p, q) <= X; p++){
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        }
        System.out.println((int)num2);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        
        int p = 2;
        int q = 1;
        double num1 = 1;
        double num2 = 1;
        double power = Math.pow(p, q);
        
        for(p = 2; Math.pow(p, q) <= X; p++){
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        }
        System.out.println((int)num2);
    } main {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        
        int p = 2;
        int q = 1;
        double num1 = 1;
        double num2 = 1;
        double power = Math.pow(p, q);
        
        for(p = 2; Math.pow(p, q) <= X; p++){
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        }
        System.out.println((int)num2);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int p = 2; p 2 int q = 1; q 1 double num1 = 1; num1 1 double num2 = 1; num2 1 double power = Math.pow(p, q); power Math.pow(p, q) Math.pow Math p q for(p = 2; Math.pow(p, q) <= X; p++){
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        } p = 2; p = 2 p 2 Math.pow(p, q) <= X Math.pow(p, q) Math.pow Math p q X p++ p++ p {
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        } {
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        } for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            } q = 2; q = 2 q 2 Math.pow(p, q) <= X Math.pow(p, q) Math.pow Math p q X q++ q++ q {
                num1 = Math.pow(p, q);
            } {
                num1 = Math.pow(p, q);
            } num1 = Math.pow(p, q) num1 Math.pow(p, q) Math.pow Math p q if(num2 < num1){
                num2 = num1;
            } num2 < num1 num2 num1 {
                num2 = num1;
            } num2 = num1 num2 num1 q = 1 q 1 System.out.println((int)num2) System.out.println System.out System System.out (int)num2 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        
        int p = 2;
        int q = 1;
        double num1 = 1;
        double num2 = 1;
        double power = Math.pow(p, q);
        
        for(p = 2; Math.pow(p, q) <= X; p++){
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        }
        System.out.println((int)num2);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        
        int p = 2;
        int q = 1;
        double num1 = 1;
        double num2 = 1;
        double power = Math.pow(p, q);
        
        for(p = 2; Math.pow(p, q) <= X; p++){
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        }
        System.out.println((int)num2);
    }
} Main

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        
        int p = 2;
        int q = 1;
        double num1 = 1;
        double num2 = 1;
        double power = Math.pow(p, q);
        
        for(p = 2; Math.pow(p, q) <= X; p++){
            for(q = 2; Math.pow(p, q) <= X; q++){
                num1 = Math.pow(p, q);
            }
            if(num2 < num1){
                num2 = num1;
            }
            q = 1;
        }
        System.out.println((int)num2);
    }
}