import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    int max = 0;
    for(int i=2; i<=x; i++) {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    }
    System.out.println(x==1?1:max);
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    int max = 0;
    for(int i=2; i<=x; i++) {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    }
    System.out.println(x==1?1:max);
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    int max = 0;
    for(int i=2; i<=x; i++) {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    }
    System.out.println(x==1?1:max);
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    int max = 0;
    for(int i=2; i<=x; i++) {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    }
    System.out.println(x==1?1:max);
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int x = Integer.parseInt(in.readLine()); x Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in int max = 0; max 0 for(int i=2; i<=x; i++) {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    } int i=2; int i=2; i 2 i<=x i x i++ i++ i {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    } {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    } for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      } int j=2; int j=2; j 2 Math.pow(i,j)<=x Math.pow(i,j) Math.pow Math i j x j++ j++ j {
          max = Math.max((int)Math.pow(i,j),max);
      } {
          max = Math.max((int)Math.pow(i,j),max);
      } max = Math.max((int)Math.pow(i,j),max) max Math.max((int)Math.pow(i,j),max) Math.max Math (int)Math.pow(i,j) Math.pow Math i j max System.out.println(x==1?1:max) System.out.println System.out System System.out x==1?1:max x==1 x 1 1 max String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    int max = 0;
    for(int i=2; i<=x; i++) {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    }
    System.out.println(x==1?1:max);
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    int max = 0;
    for(int i=2; i<=x; i++) {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    }
    System.out.println(x==1?1:max);
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    int max = 0;
    for(int i=2; i<=x; i++) {
      for(int j=2; Math.pow(i,j)<=x; j++) {
          max = Math.max((int)Math.pow(i,j),max);
      }
    }
    System.out.println(x==1?1:max);
  }
}