import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
         int x = Integer.parseInt(sc.next());
         int ans = 1;
         for(int i =2;i<=x;i++){
             for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             }
         }
         System.out.println(ans);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
         int x = Integer.parseInt(sc.next());
         int ans = 1;
         for(int i =2;i<=x;i++){
             for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             }
         }
         System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
         int x = Integer.parseInt(sc.next());
         int ans = 1;
         for(int i =2;i<=x;i++){
             for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             }
         }
         System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
         int x = Integer.parseInt(sc.next());
         int ans = 1;
         for(int i =2;i<=x;i++){
             for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             }
         }
         System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = Integer.parseInt(sc.next()); x Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ans = 1; ans 1 for(int i =2;i<=x;i++){
             for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             }
         } int i =2; int i =2; i 2 i<=x i x i++ i++ i {
             for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             }
         } {
             for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             }
         } for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             } int j = i*i; int j = i*i; j i*i i i j<=x j x j=j*i j=j*i j j*i j i {
                 ans = Math.max(ans,j);
             } {
                 ans = Math.max(ans,j);
             } ans = Math.max(ans,j) ans Math.max(ans,j) Math.max Math ans j System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
         int x = Integer.parseInt(sc.next());
         int ans = 1;
         for(int i =2;i<=x;i++){
             for(int j = i*i;j<=x;j=j*i){
                 ans = Math.max(ans,j);
             }
         }
         System.out.println(ans);
    }
}