#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,ans;
int main(void){
    cin>>n;
    for(ll i=1LL;i*i<n;i++){
        if(n%i==0){
            if(n%(n/i-1)==n/(n/i-1))ans+=n/i-1;
        }
    }
    cout<<ans<<endl;
}
