require 'prime'

N = gets.to_i

if N == 1
  puts 0
  exit
end

factors = N.prime_division.to_h

fs = factors.values.map do |val|
  (0..val).to_a
end
res = 0

[0].product(*fs).each do |ar|
  current = 1
  ar.slice(1, ar.length).each_with_index do |val, i|
    current *= factors.keys[i]**val
  end

  p = current
  m = N/p - 1
  if p < m
    res += m
  end
end
puts res
