require'prime' n=gets.to_i p (n&1<1?n/2:n).prime_division.map{|a,b|a*(a**b-1)/a-=1}.reduce(1,:*)