#include using namespace std; using ll = long long; int main(int argc, const char *argv[]) { // ll a; cin >> a; ll ans = a; for (int i = 2; i * i <= a; ++i) { ll cur = i, j = 1; while (cur < a) { cur *= i; j++; } if (i * j < ans) { ans = i * j; } else { break; } } cout << ans << '\n'; }