#include #include #include #include #include #include #include #include #define REP(i,k,n) for(int i=k;i P; vector divisor(ll n) { vector res; for(ll i = 2; i*i <= n; i++) { if(n % i == 0) { res.push_back(i); if(i != n/i) res.push_back(n/i); } } return res; } int main() { ll n; cin >> n; ll a = n; ll b = (n-1)*n/2; ll c = __gcd(a,b); vector ret = divisor(c); ret.push_back(1); if(c != 1) ret.push_back(c); ll ans = 0; rep(i,ret.size()) { ans += ret[i]; } cout << ans << endl; return 0; }