import java.io.*;

class Main
{
    public static void main(String[] args) throws IOException
    {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	String str = br.readLine();

	int X = Integer.parseInt(str);

	find_max(2, 2, X, 1);
    }

    public static void find_max(int e, int x, int X, int max)
    {
	if(X == 1 || X == 2 || X == 3){
	    System.out.println(1);
	}else{
	    if(Math.pow((double) e, (double) x) <= (double) X){
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    }else{
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    }
	}
    }
} import java.io.*; io.* java class Main
{
    public static void main(String[] args) throws IOException
    {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	String str = br.readLine();

	int X = Integer.parseInt(str);

	find_max(2, 2, X, 1);
    }

    public static void find_max(int e, int x, int X, int max)
    {
	if(X == 1 || X == 2 || X == 3){
	    System.out.println(1);
	}else{
	    if(Math.pow((double) e, (double) x) <= (double) X){
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    }else{
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    }
	}
    }
} Main public static void main(String[] args) throws IOException
    {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	String str = br.readLine();

	int X = Integer.parseInt(str);

	find_max(2, 2, X, 1);
    } main {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	String str = br.readLine();

	int X = Integer.parseInt(str);

	find_max(2, 2, X, 1);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br int X = Integer.parseInt(str); X Integer.parseInt(str) Integer.parseInt Integer str find_max(2, 2, X, 1) find_max 2 2 X 1 String[] args args public static void find_max(int e, int x, int X, int max)
    {
	if(X == 1 || X == 2 || X == 3){
	    System.out.println(1);
	}else{
	    if(Math.pow((double) e, (double) x) <= (double) X){
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    }else{
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    }
	}
    } find_max {
	if(X == 1 || X == 2 || X == 3){
	    System.out.println(1);
	}else{
	    if(Math.pow((double) e, (double) x) <= (double) X){
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    }else{
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    }
	}
    } if(X == 1 || X == 2 || X == 3){
	    System.out.println(1);
	}else{
	    if(Math.pow((double) e, (double) x) <= (double) X){
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    }else{
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    }
	} X == 1 || X == 2 || X == 3 X == 1 || X == 2 || X == 3 X == 1 X 1 X == 2 X 2 X == 3 X 3 {
	    System.out.println(1);
	} System.out.println(1) System.out.println System.out System System.out 1 {
	    if(Math.pow((double) e, (double) x) <= (double) X){
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    }else{
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    }
	} if(Math.pow((double) e, (double) x) <= (double) X){
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    }else{
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    } Math.pow((double) e, (double) x) <= (double) X Math.pow((double) e, (double) x) Math.pow Math (double) e (double) x (double) X {
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    } if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		} Math.pow((double) e, (double) x) > (double) max Math.pow((double) e, (double) x) Math.pow Math (double) e (double) x (double) max {
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		} find_max(e, x+1, X, (int) Math.pow((double) e, (double) x)) find_max e x+1 x 1 X (int) Math.pow((double) e, (double) x) Math.pow Math (double) e (double) x {
		    find_max(e, x+1, X, max);
		} find_max(e, x+1, X, max) find_max e x+1 x 1 X max {
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    } if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		} Math.pow((double) (e+1), (double) 2) <= (double) X Math.pow((double) (e+1), (double) 2) Math.pow Math (double) (e+1) e 1 (double) 2 (double) X {
		    find_max(e+1, 2, X, max);
		} find_max(e+1, 2, X, max) find_max e+1 e 1 2 X max {
		    System.out.println(max);
		} System.out.println(max) System.out.println System.out System System.out max int e e int x x int X X int max max
import java.io.*;

class Main
{
    public static void main(String[] args) throws IOException
    {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	String str = br.readLine();

	int X = Integer.parseInt(str);

	find_max(2, 2, X, 1);
    }

    public static void find_max(int e, int x, int X, int max)
    {
	if(X == 1 || X == 2 || X == 3){
	    System.out.println(1);
	}else{
	    if(Math.pow((double) e, (double) x) <= (double) X){
		if(Math.pow((double) e, (double) x) > (double) max){
		    find_max(e, x+1, X, (int) Math.pow((double) e, (double) x));
		}else{
		    find_max(e, x+1, X, max);
		}
	    }else{
		if(Math.pow((double) (e+1), (double) 2) <= (double) X){
		    find_max(e+1, 2, X, max);
		}else{
		    System.out.println(max);
		}
	    }
	}
    }
}