require 'prime'
def phi_func(n)
    factors=n.prime_division
    fct=factors.pop
    phi=(fct[0]-1)*fct[0]**(fct[1]-1)
    if factors.size.zero?
        return phi
    else
        m=Prime.int_from_prime_division(factors)
        return phi*phi_func(m)
    end
end

n=gets.to_i
p phi_func(n)
