import java.util.Scanner;

class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    double num;

    num = sc.nextInt();

    double temporaryNum = 1;
    if (num < 4) {
      System.out.println(1);
      return;
    }

    for (int i = 2; Math.pow(i, 2) <= num; i++) {
      for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      }
    }
    System.out.println((int)temporaryNum);
    return;
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    double num;

    num = sc.nextInt();

    double temporaryNum = 1;
    if (num < 4) {
      System.out.println(1);
      return;
    }

    for (int i = 2; Math.pow(i, 2) <= num; i++) {
      for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      }
    }
    System.out.println((int)temporaryNum);
    return;
  }
} Main public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    double num;

    num = sc.nextInt();

    double temporaryNum = 1;
    if (num < 4) {
      System.out.println(1);
      return;
    }

    for (int i = 2; Math.pow(i, 2) <= num; i++) {
      for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      }
    }
    System.out.println((int)temporaryNum);
    return;
  } main {
    Scanner sc = new Scanner(System.in);

    double num;

    num = sc.nextInt();

    double temporaryNum = 1;
    if (num < 4) {
      System.out.println(1);
      return;
    }

    for (int i = 2; Math.pow(i, 2) <= num; i++) {
      for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      }
    }
    System.out.println((int)temporaryNum);
    return;
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double num; num num = sc.nextInt() num sc.nextInt() sc.nextInt sc double temporaryNum = 1; temporaryNum 1 if (num < 4) {
      System.out.println(1);
      return;
    } num < 4 num 4 {
      System.out.println(1);
      return;
    } System.out.println(1) System.out.println System.out System System.out 1 return; for (int i = 2; Math.pow(i, 2) <= num; i++) {
      for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      }
    } int i = 2; int i = 2; i 2 Math.pow(i, 2) <= num Math.pow(i, 2) Math.pow Math i 2 num i++ i++ i {
      for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      }
    } {
      for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      }
    } for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      } int n = 2; int n = 2; n 2 Math.pow(i, n) <= num Math.pow(i, n) Math.pow Math i n num n++ n++ n {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      } {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      } if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         } temporaryNum < Math.pow(i, n) temporaryNum Math.pow(i, n) Math.pow Math i n {
           temporaryNum = Math.pow(i, n);
         } temporaryNum = Math.pow(i, n) temporaryNum Math.pow(i, n) Math.pow Math i n System.out.println((int)temporaryNum) System.out.println System.out System System.out (int)temporaryNum return; String args[] args
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    double num;

    num = sc.nextInt();

    double temporaryNum = 1;
    if (num < 4) {
      System.out.println(1);
      return;
    }

    for (int i = 2; Math.pow(i, 2) <= num; i++) {
      for (int n = 2; Math.pow(i, n) <= num; n++) {
         if (temporaryNum < Math.pow(i, n)) {
           temporaryNum = Math.pow(i, n);
         }
      }
    }
    System.out.println((int)temporaryNum);
    return;
  }
}
