require 'prime'

def _divisors(primes, k)
Enumerator.new do |y|
if primes.size == k
y << 1
else
p, e = primes[k]
_divisors(primes, k + 1).each {|d|
(e + 1).times {|e1|
y << p ** e1 * d
 }
 }
end
end
end

def divisors(n)
 _divisors(Prime.prime_division(n), 0).to_a.sort
end

n=gets.to_i
array=divisors(n)
m=array.length
index=(0...m-1).bsearch {|i| array[i]*(array[i]+1)>=n}
ans2=0
array[0...index].map{|value|
    ans2+=n/value-1
}

puts ans2