#include using namespace std; int64_t mul(int64_t a, int64_t b) { if(b <= 1e18 / a) return a*b; return 2e18; } int64_t fpow(int64_t b, int64_t e) { int64_t r = 1; while(e) { if(e%2) r = mul(r, b); e /= 2; if(e) b = mul(b, b); } return r; } int64_t guess(int64_t p, int64_t n) { int64_t lhs = 1; int64_t rhs = n; while(lhs <= rhs) { int64_t mid = (lhs+rhs)/2; int64_t cand = fpow(mid, p); if(cand == n) return mid; if(cand < n) lhs = mid+1; else rhs = mid-1; } return -1; } int tau(int64_t n) { int ret = 1; for(int i = 2; i*i <= n; i++) { int c = 1; while(n%i==0) { n /= i; c++; } ret *= c; } if(n>1) ret *= 2; return ret; } int main() { int64_t n; cin >> n; if(n == 1) { cout << "1\n"; return 0; } int ret = 60; while(ret > 1) { int64_t cand = guess(ret, n); if(cand >= 0 && tau(cand) == ret) { cout << cand << "\n"; return 0; } ret--; } cout << "-1\n"; }