n = gets.chomp.to_i

require 'prime'

arr = n.prime_division

if arr.size == 1
  puts(n - 1)
else
  primes = []
  arr.each do |v, i|
    i.times do
      primes.push v
    end
  end

  ans = 0
  primes.each.with_index(1) do |p, j|
    next if j == 1
    if j == 2
      ans += primes[0] + p - 2
    else
      ans += primes[0] * p - primes[0]
    end
  end
  puts ans
end
