import std.stdio, std.range, std.algorithm, std.conv, std.string, std.array, std.typecons, std.format;

void main() {
    long n;
    long ans = 0;
    readf("%d", &n);

    for (long i = 1; i < n; i++) {
        long q = (n - i) / i;
        long r = (n - i) % i;
        if (i >= q) {
            break;
        }
        if (r == 0) {
            // writeln(q);
            ans += q;
        }
    }
    writeln(ans);

    /*
    long naive = 0;
    for (long i = 1; i < n; i++) {
        if (n / i == n % i) {
            writefln("[%d]*%d + %d = %d", i, n/i, n%i, n);
            naive += i;
        } else {
            writefln("%d*%d + %d = %d", i, n/i, n%i, n);
        }
    }
    writeln(naive);
    */

}

