#include <cmath>
#include <iostream>
#include <set>

int main() {
  uint32_t n = 0;
  std::cin >> n;

  std::set<uint32_t> divisors;
  uint32_t remain = n;
  while (remain % 2 == 0) {
    remain /= 2;
    divisors.insert(2);
  }

  for (size_t i = 3; i * i <= remain; i += 2) {
    while (remain % i == 0) {
      remain /= i;
      divisors.insert(i);
    }
  }
  if (remain != 1) divisors.insert(remain);

  uint64_t numerator = 1, denominator = 1;
  for (auto &&d : divisors) {
    numerator *= d - 1;
    denominator *= d;
  }
  std::cout << n * numerator / denominator << std::endl;

  return 0;
}
