import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto x = readln.chomp.to!double;
  int[int] a;
  auto x2 = sqrt(x).to!int + 1;
  a[1] = 1;
  foreach (i; 2..x2) {
    auto tmp = i ^^ 2;
    while (tmp <= x) {
      a[tmp] = 1;
      tmp *= i;
    }
  }

  sort(a.keys)[$-1].writeln;
}
