import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        String line = readLine();
        StringTokenizer st = new StringTokenizer(line, " ");
        int x = Integer.parseInt(st.nextToken());

        double X = (double)x;
        List<Double> list = new ArrayList<Double>();

        for (int i=1; i<=x; i++) {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        }
        double ans = Collections.max(list);
        System.out.println(String.valueOf((int)ans));

    }

    private static String readLine() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        return br.readLine();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String[] args) throws Exception {
        String line = readLine();
        StringTokenizer st = new StringTokenizer(line, " ");
        int x = Integer.parseInt(st.nextToken());

        double X = (double)x;
        List<Double> list = new ArrayList<Double>();

        for (int i=1; i<=x; i++) {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        }
        double ans = Collections.max(list);
        System.out.println(String.valueOf((int)ans));

    }

    private static String readLine() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        return br.readLine();
    }
} Main public static void main(String[] args) throws Exception {
        String line = readLine();
        StringTokenizer st = new StringTokenizer(line, " ");
        int x = Integer.parseInt(st.nextToken());

        double X = (double)x;
        List<Double> list = new ArrayList<Double>();

        for (int i=1; i<=x; i++) {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        }
        double ans = Collections.max(list);
        System.out.println(String.valueOf((int)ans));

    } main {
        String line = readLine();
        StringTokenizer st = new StringTokenizer(line, " ");
        int x = Integer.parseInt(st.nextToken());

        double X = (double)x;
        List<Double> list = new ArrayList<Double>();

        for (int i=1; i<=x; i++) {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        }
        double ans = Collections.max(list);
        System.out.println(String.valueOf((int)ans));

    } String line = readLine(); line readLine() readLine StringTokenizer st = new StringTokenizer(line, " "); st new StringTokenizer(line, " ") int x = Integer.parseInt(st.nextToken()); x Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st double X = (double)x; X (double)x List<Double> list = new ArrayList<Double>(); list new ArrayList<Double>() for (int i=1; i<=x; i++) {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        } int i=1; int i=1; i 1 i<=x i x i++ i++ i {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        } {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        } for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	} int j=2; int j=2; j 2 j<=32 j 32 j++ j++ j {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	} {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	} if (Math.pow((double)i, (double)j)>X) {
        			break;
        		} Math.pow((double)i, (double)j)>X Math.pow((double)i, (double)j) Math.pow Math (double)i (double)j X {
        			break;
        		} break; list.add(Math.pow((double)i, (double)j)) list.add list Math.pow((double)i, (double)j) Math.pow Math (double)i (double)j double ans = Collections.max(list); ans Collections.max(list) Collections.max Collections list System.out.println(String.valueOf((int)ans)) System.out.println System.out System System.out String.valueOf((int)ans) String.valueOf String (int)ans String[] args args private static String readLine() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        return br.readLine();
    } readLine {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        return br.readLine();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) return br.readLine(); br.readLine() br.readLine br public class Main {
    public static void main(String[] args) throws Exception {
        String line = readLine();
        StringTokenizer st = new StringTokenizer(line, " ");
        int x = Integer.parseInt(st.nextToken());

        double X = (double)x;
        List<Double> list = new ArrayList<Double>();

        for (int i=1; i<=x; i++) {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        }
        double ans = Collections.max(list);
        System.out.println(String.valueOf((int)ans));

    }

    private static String readLine() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        return br.readLine();
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        String line = readLine();
        StringTokenizer st = new StringTokenizer(line, " ");
        int x = Integer.parseInt(st.nextToken());

        double X = (double)x;
        List<Double> list = new ArrayList<Double>();

        for (int i=1; i<=x; i++) {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        }
        double ans = Collections.max(list);
        System.out.println(String.valueOf((int)ans));

    }

    private static String readLine() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        return br.readLine();
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        String line = readLine();
        StringTokenizer st = new StringTokenizer(line, " ");
        int x = Integer.parseInt(st.nextToken());

        double X = (double)x;
        List<Double> list = new ArrayList<Double>();

        for (int i=1; i<=x; i++) {
        	for (int j=2;j<=32;j++) {
        		if (Math.pow((double)i, (double)j)>X) {
        			break;
        		}
        		list.add(Math.pow((double)i, (double)j));
        	}
        }
        double ans = Collections.max(list);
        System.out.println(String.valueOf((int)ans));

    }

    private static String readLine() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        return br.readLine();
    }
}
