import math

N=int(eval(input()))

a=int((math.sqrt(N)//1))

ans=0

if N==2:

  print((0))

  exit()

for i in range(1,a):

  b=(N-i)/i

  if b.is_integer():

    ans+=int(b)

c=N//a

d=N%a

if int(c)==d:

  ans+=a

a+=1

c=N//a

d=N%a

if int(c)==d:

  ans+=a

print(ans)
N=int(eval(input()))

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)

  return divisors

A=make_divisors(N)

ans=0

for i in A:

  if i==1:

    continue

  a=N//(i-1)

  b=N%(i-1)

  if a==b:

    ans+=(i-1)

print(ans)
import math

N = int(eval(input()))
a = int((math.sqrt(N) // 1))
ans = 0
if N == 2:
    print((0))
    exit()
for i in range(1, a):
    b = (N - i) / i
    if b.is_integer():
        ans += int(b)
c = N // a
d = N % a
if int(c) == d:
    ans += a
a += 1
c = N // a
d = N % a
if int(c) == d:
    ans += a
print(ans)

N = int(eval(input()))


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)
    return divisors


A = make_divisors(N)
ans = 0
for i in A:
    if i == 1:
        continue
    a = N // (i - 1)
    b = N % (i - 1)
    if a == b:
        ans += i - 1
print(ans)

-import math +N = int(eval(input())) -N = int(eval(input())) -a = int((math.sqrt(N) // 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) +    return divisors + + +A = make_divisors(N) -if N == 2: -    print((0)) -    exit() -for i in range(1, a): -    b = (N - i) / i -    if b.is_integer(): -        ans += int(b) -c = N // a -d = N % a -if int(c) == d: -    ans += a -a += 1 -c = N // a -d = N % a -if int(c) == d: -    ans += a +for i in A: +    if i == 1: +        continue +    a = N // (i - 1) +    b = N % (i - 1) +    if a == b: +        ans += i - 1