#include #include using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=14449999999999999; ll mod=998244353; int main(){ ll n; cin >> n; ll ans=n-1; for (ll i = 2; i >=0; i++) { bool ok=false; for (ll j = 2; j >=0; j++) { ll x=0; ll now=1; for (ll k = 0; k < i; k++) { if (x>n) { break; } x+=now; now*=j; } if (x>n) { break; } if (n%x==0&&n/x