from math import floor



N = int(eval(input()))

ans = 0

sup = floor(pow(N,1/2))

for r in range(1,sup+1):

    if N % r == 0:

        m = N // r - 1

        if 0 <= r <= m-1:

            ans += m

print(ans)
from math import floor



def divisor(n):

    left = [1]

    right = [n]

    sup = floor(pow(n,1/2))

    for p in range(2,sup+1):

        if n % p == 0:

            left.append(p)

            right.append(n//p)

    res = left + right[::-1]

    return res

        

N = int(eval(input()))



div = divisor(N)

ans = 0



for d in div:

    if d != 1 and N // (d-1) == N % (d-1):

        ans += (d-1)



print(ans)
from math import floor

N = int(eval(input()))
ans = 0
sup = floor(pow(N, 1 / 2))
for r in range(1, sup + 1):
    if N % r == 0:
        m = N // r - 1
        if 0 <= r <= m - 1:
            ans += m
print(ans)

from math import floor


def divisor(n):
    left = [1]
    right = [n]
    sup = floor(pow(n, 1 / 2))
    for p in range(2, sup + 1):
        if n % p == 0:
            left.append(p)
            right.append(n // p)
    res = left + right[::-1]
    return res


N = int(eval(input()))
div = divisor(N)
ans = 0
for d in div:
    if d != 1 and N // (d - 1) == N % (d - 1):
        ans += d - 1
print(ans)

+ +def divisor(n): +    left = [1] +    right = [n] +    sup = floor(pow(n, 1 / 2)) +    for p in range(2, sup + 1): +        if n % p == 0: +            left.append(p) +            right.append(n // p) +    res = left + right[::-1] +    return res + + +div = divisor(N) -sup = floor(pow(N, 1 / 2)) -for r in range(1, sup + 1): -    if N % r == 0: -        m = N // r - 1 -        if 0 <= r <= m - 1: -            ans += m +for d in div: +    if d != 1 and N // (d - 1) == N % (d - 1): +        ans += d - 1