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