class Integer
  def totient_function
    require 'prime'
    r = 1

    self.prime_division.each do |e, n|
      r *= (1 - Rational(1, e))
    end

    (self * r).to_i
  end
end

N = gets.to_i

puts N.totient_function

