import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;
import java.util.Map;
import java.util.HashMap;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		double X = sc.nextDouble();
		double max = 0;
		for(double b=1; Math.pow(b, 2)<=X; b++){
			for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			}
		}
		System.out.println((int)max);
	}	
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Iterator; Iterator java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.Random; Random java.util import java.util.Map; Map java.util import java.util.HashMap; HashMap java.util class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		double X = sc.nextDouble();
		double max = 0;
		for(double b=1; Math.pow(b, 2)<=X; b++){
			for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			}
		}
		System.out.println((int)max);
	}	
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		double X = sc.nextDouble();
		double max = 0;
		for(double b=1; Math.pow(b, 2)<=X; b++){
			for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			}
		}
		System.out.println((int)max);
	} main {
		Scanner sc = new Scanner(System.in);
		double X = sc.nextDouble();
		double max = 0;
		for(double b=1; Math.pow(b, 2)<=X; b++){
			for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			}
		}
		System.out.println((int)max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double X = sc.nextDouble(); X sc.nextDouble() sc.nextDouble sc double max = 0; max 0 for(double b=1; Math.pow(b, 2)<=X; b++){
			for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			}
		} double b=1; double b=1; b 1 Math.pow(b, 2)<=X Math.pow(b, 2) Math.pow Math b 2 X b++ b++ b {
			for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			}
		} {
			for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			}
		} for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			} double j=2; double j=2; j 2 Math.pow(b, j) <= X Math.pow(b, j) Math.pow Math b j X j++ j++ j {
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			} {
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			} max = Math.max(max, Math.pow(b, j)) max Math.max(max, Math.pow(b, j)) Math.max Math max Math.pow(b, j) Math.pow Math b j if(b==1)break; b==1 b 1 break; System.out.println((int)max) System.out.println System.out System System.out (int)max String args[] args
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;
import java.util.Map;
import java.util.HashMap;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		double X = sc.nextDouble();
		double max = 0;
		for(double b=1; Math.pow(b, 2)<=X; b++){
			for(double j=2; Math.pow(b, j) <= X; j++){
				max = Math.max(max, Math.pow(b, j));
				//System.out.print("\rb="+b+" j="+j);
				if(b==1)break;
			}
		}
		System.out.println((int)max);
	}	
}