import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int ans = 1;

        if(x >= 4){
            for(int i=2; i*i <= x; i++)
            {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            }
        }
        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 = sc.nextInt();
        int ans = 1;

        if(x >= 4){
            for(int i=2; i*i <= x; i++)
            {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int ans = 1;

        if(x >= 4){
            for(int i=2; i*i <= x; i++)
            {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int ans = 1;

        if(x >= 4){
            for(int i=2; i*i <= x; i++)
            {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int ans = 1; ans 1 if(x >= 4){
            for(int i=2; i*i <= x; i++)
            {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            }
        } x >= 4 x 4 {
            for(int i=2; i*i <= x; i++)
            {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            }
        } for(int i=2; i*i <= x; i++)
            {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            } int i=2; int i=2; i 2 i*i <= x i*i i i x i++ i++ i {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            } {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            } int j=1; j 1 double num = 1; num 1 while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                } num <= x num x {
                    j++;
                    num = Math.pow(i, j);
                } j++ j num = Math.pow(i, j) num Math.pow(i, j) Math.pow Math i j num = num/i num num/i num i if(num > ans && num <= x){
                    ans = (int)(num);
                } num > ans && num <= x num > ans num ans num <= x num x {
                    ans = (int)(num);
                } ans = (int)(num) ans (int)(num) 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 = sc.nextInt();
        int ans = 1;

        if(x >= 4){
            for(int i=2; i*i <= x; i++)
            {
                int j=1;
                double num = 1;
                while(num <= x){
                    j++;
                    num = Math.pow(i, j);
                }
                num = num/i;
                if(num > ans && num <= x){
                    ans = (int)(num);
                }
            }
        }
        System.out.println(ans);
    }
}