inputs = readlines
# inputs = "1\n".split("\n")

n = inputs[0].to_i

def solve(n)
  sum = 0
  ps = (1..n).to_a
  ps.unshift(ps.pop)
  ps.each_with_index do |p, index|
    sum += p % (index + 1)
  end
  sum
end

puts solve(n)

