#include long long int pow(long long int a, long long int n) { long long int res = 1; while (n > 0) { if (n % 2 > 0) res = res * a; a = a * a; n /= 2; } return res; } long long int root(long long int a, long long int n) { long long int min, mid, max; min = 0; max = 1; while (pow(max, n) < a) max *= 2; while (max - min > 1) { mid = (max + min) / 2; if (pow(mid, n) < a) min = mid; else max = mid; } return max; } int main() { long long int a; scanf("%lld", &a); long long int i, ans = a, r; for (i = 2;; i++) { r = root(a, i); if (ans > r * i) ans = r * i; if (r == 2) break; } printf("%lld\n", ans); return 0; }