def x2(n)
  rn=(1+Math.sqrt(1+4*n)).floor/2
  divisors=[]
  factors=Hash.new(0)
  othersum=0
  n2=n
  (2..rn).each do |i|
    if n%i==0
      othersum+=i-1
      divisors << i
    end
    while n2%i==0
      n2/=i
      factors[i]+=1
    end
  end
  factors[n2]+=1 if n2!=1
  divisorssum=1
  divisorsnum=1
  factors.each do |f,m|
    divisorsnum*=m+1
    divisorssum*=(f**(m+1)-1)/(f-1)
  end
  return divisorssum-divisorsnum-othersum
end

puts x2(gets.to_i)