#include <bits/stdc++.h>
using namespace std;
unsigned long long res=0,n;
int main()
{
    cin>>n;
    int x=ceil(sqrt(n));
    for (int i=1;i<x;++i)
        if (n%i==0&&n/(n/i-1)==n%(n/i-1)) res=res+n/i-1;
    cout<<res;
    return 0;
}
