#include #define pt(sth) cout << sth << "\n" #define chmax(a, b) {if(ab) a=b;} #define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD using namespace std; typedef long long ll; typedef pair P; static const ll INF=1e18; static const ll MAX=101010; static const ll MOD=1e9+7; map prime; void factrization(ll n) { for(ll i=2; i*i<=n; i++) { while(n%i==0) { prime[i]++; n/=i; } } if(n>1) prime[n]++; } int main(void) { ll X; cin >> X; ll i; for(i=1; i> v; for(i=-3*sqrt(X); i<3*sqrt(X); i++) { ll A=X/2-i; ll B=(X+1)/2+i; prime.clear(); factrization(A); ll da=1; for(auto it=prime.begin(); it!=prime.end(); it++) { da*=it->second+1; } prime.clear(); factrization(B); ll db=1; for(auto it=prime.begin(); it!=prime.end(); it++) { db*=it->second+1; } ll fa=A-da; ll fb=B-db; v.push_back({abs(fa-fb), {A, B}}); } sort(v.begin(), v.end()); ll t=v[0].first; for(i=0; i