#include using namespace std; typedef long long ll; typedef pair< int, int > pii; typedef vector< int > vi; typedef vector< vi > vvi; typedef vector< ll > vl; typedef vector< vl > vvl; typedef vector< pii > vp; typedef vector< vp > vvp; typedef vector< string > vs; typedef vector< double > vd; typedef vector< vd > vvd; template< class T1, class T2 > int upmin( T1 &x, T2 v ){ if( x > v ){ x = v; return 1; } return 0; } template< class T1, class T2 > int upmax( T1 &x, T2 v ){ if( x < v ){ x = v; return 1; } return 0; } ll N; void init(){ cin >> N; } void preprocess(){ } void solve(){ ll a = N + 1; ll b = N; if( a % 2 ) b /= 2; else a /= 2; ll x = __gcd( N, a ) / __gcd( a, b ) * __gcd( N, b ); ll ans = 0; for( int i = 1; 1LL * i * i <= x; ++i ) if( x % i == 0 ){ ans += i; if( 1LL * i * i != x ) ans += x / i; } cout << ans << endl; } signed main(){ ios::sync_with_stdio( 0 ); init(); preprocess(); solve(); return 0; }