#N=gets.to_i
#S=gets.chomp
#A=(0...N).map{gets.to_i}
#sum=A.inject(&:+)
#B=gets.split.map(&:to_i)
N=gets.to_i
 
rn=(1+Math.sqrt(1+4*N)).floor/2
 
divisors=[]
 
othersum=0
 
(2..rn).each do |i|
  if N%i==0
    othersum+=i-1
    divisors << i
  end
end
 
divisors << N
 
n=N
 
factors=Hash.new(0)
 
divisors.each do |d|
  break if n==1
  if n%d==0
    factors[d]+=1
    n/=d
    redo
  end
end
 
divisorssum=1
divisorsnum=1
factors.each do |f,m|
  divisorsnum*=m+1
  divisorssum*=(f**(m+1)-1)/(f-1)
end
 
puts divisorssum-divisorsnum-othersum