Snuke received a positive integer N from Takahashi. A positive integer m is called a _favorite number_ when the following condition is satisfied:    * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod m holds.  Find all favorite numbers and print the sum of those.
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())

for i in range(1, 1000):
    if n%i == n//i:
        print(i, n%i)
    #if ((n-i)/i)%1 == 0:
        #print(i)



ans = 0
for i in make_divisors(n):
    if i > n ** 0.5:
        ans += i-1

print(ans)
print(1)
#%%
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())


ans = 0
for i in make_divisors(n):
    if i >= n ** 0.5 + 1:
        ans += i-1

print(ans)