import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int x = sc.nextInt();
	int ans = 0;
	if(x<4) {
	    System.out.println(1);
	    return;
	}
	for(int i = 2; i<40; i++) {
	    int tmp = i;
	    int cnt = 0;
	    while(tmp<=x) {
		tmp *= i;
		cnt++;
	    }
	    if(cnt>=2) ans = Math.max(ans, tmp/i);
	}
	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 = 0;
	if(x<4) {
	    System.out.println(1);
	    return;
	}
	for(int i = 2; i<40; i++) {
	    int tmp = i;
	    int cnt = 0;
	    while(tmp<=x) {
		tmp *= i;
		cnt++;
	    }
	    if(cnt>=2) ans = Math.max(ans, tmp/i);
	}
	System.out.println(ans);
    }
} Main public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int x = sc.nextInt();
	int ans = 0;
	if(x<4) {
	    System.out.println(1);
	    return;
	}
	for(int i = 2; i<40; i++) {
	    int tmp = i;
	    int cnt = 0;
	    while(tmp<=x) {
		tmp *= i;
		cnt++;
	    }
	    if(cnt>=2) ans = Math.max(ans, tmp/i);
	}
	System.out.println(ans);
    } main {
	Scanner sc = new Scanner(System.in);
	int x = sc.nextInt();
	int ans = 0;
	if(x<4) {
	    System.out.println(1);
	    return;
	}
	for(int i = 2; i<40; i++) {
	    int tmp = i;
	    int cnt = 0;
	    while(tmp<=x) {
		tmp *= i;
		cnt++;
	    }
	    if(cnt>=2) ans = Math.max(ans, tmp/i);
	}
	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 = 0; ans 0 if(x<4) {
	    System.out.println(1);
	    return;
	} x<4 x 4 {
	    System.out.println(1);
	    return;
	} System.out.println(1) System.out.println System.out System System.out 1 return; for(int i = 2; i<40; i++) {
	    int tmp = i;
	    int cnt = 0;
	    while(tmp<=x) {
		tmp *= i;
		cnt++;
	    }
	    if(cnt>=2) ans = Math.max(ans, tmp/i);
	} int i = 2; int i = 2; i 2 i<40 i 40 i++ i++ i {
	    int tmp = i;
	    int cnt = 0;
	    while(tmp<=x) {
		tmp *= i;
		cnt++;
	    }
	    if(cnt>=2) ans = Math.max(ans, tmp/i);
	} {
	    int tmp = i;
	    int cnt = 0;
	    while(tmp<=x) {
		tmp *= i;
		cnt++;
	    }
	    if(cnt>=2) ans = Math.max(ans, tmp/i);
	} int tmp = i; tmp i int cnt = 0; cnt 0 while(tmp<=x) {
		tmp *= i;
		cnt++;
	    } tmp<=x tmp x {
		tmp *= i;
		cnt++;
	    } tmp *= i tmp i cnt++ cnt if(cnt>=2) ans = Math.max(ans, tmp/i); cnt>=2 cnt 2 ans = Math.max(ans, tmp/i) ans Math.max(ans, tmp/i) Math.max Math ans tmp/i tmp i 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 = 0;
	if(x<4) {
	    System.out.println(1);
	    return;
	}
	for(int i = 2; i<40; i++) {
	    int tmp = i;
	    int cnt = 0;
	    while(tmp<=x) {
		tmp *= i;
		cnt++;
	    }
	    if(cnt>=2) ans = Math.max(ans, tmp/i);
	}
	System.out.println(ans);
    }
}