n = gets.to_f

r = n
i = 2

while i * i <= n
  if n%i == 0
    while n%i == 0
      n/=i
    end
    r *= (1.0 - (1.0/i.to_f))
  end
  i += 1
end

if n > 1
  r *= (1.0 - (1.0/n.to_f))
end

puts r.to_i

