require "prime"

N = gets.to_i

arry = Prime.prime_division(N)

i = 0

pys = []

sum = 1	

while i < arry.length - 1
	sum *= arry[i][0] ** arry[i][1]
	i += 1
end

pys << sum

s = arry.size

pys << arry[s-1][0] ** arry[s-1][1]

puts pys[0] + pys[1] - 2