#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long n; cin>>n;
    long res=0;
    for(long i=1; i*i<=n; ++i) {
        if ((n-i)%i>0) continue;
        auto m=(n-i)/i;
        if (m>0 and n/m==n%m) res+=m;
    }
    cout<<res<<endl;
}
