import java.util.*;


public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1);
for(int count=2;count<11;count++){
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
}
Collections.sort(list);

        System.out.print(list.get(list.size()-1));

  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1);
for(int count=2;count<11;count++){
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
}
Collections.sort(list);

        System.out.print(list.get(list.size()-1));

  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1);
for(int count=2;count<11;count++){
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
}
Collections.sort(list);

        System.out.print(list.get(list.size()-1));

  } main {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1);
for(int count=2;count<11;count++){
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
}
Collections.sort(list);

        System.out.print(list.get(list.size()-1));

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() list.add(1) list.add list 1 for(int count=2;count<11;count++){
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
} int count=2; int count=2; count 2 count<11 count 11 count++ count++ count {
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
} {
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
} Collections.sort(list) Collections.sort Collections list System.out.print(list.get(list.size()-1)) System.out.print System.out System System.out list.get(list.size()-1) list.get list list.size()-1 list.size() list.size list 1 String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1);
for(int count=2;count<11;count++){
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
}
Collections.sort(list);

        System.out.print(list.get(list.size()-1));

  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1);
for(int count=2;count<11;count++){
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
}
Collections.sort(list);

        System.out.print(list.get(list.size()-1));

  }
} Main
import java.util.*;


public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(1);
for(int count=2;count<11;count++){
inner:  for(int i=2;i<=(int)Math.pow(x,0.5);i++){
        if((int)Math.pow(i,count)<=x){
        list.add((int)Math.pow(i,count));
      }else{
        break inner ;
      }
    }
}
Collections.sort(list);

        System.out.print(list.get(list.size()-1));

  }
}
