#include <bits/stdc++.h>
using namespace std;
#define task "SHT"
int main()
{
freopen(task ".inp","r",stdin);
freopen(task ".out", "w", stdout);
   long long n,d=0; cin>>n;
   for (long long i=1; i<=n/2; i++)
    if (n%i==0) d=d+i;
   cout <<d;
}
