#include<bits/stdc++.h>
using namespace std;
int64_t euler_phi(int64_t n) {
  int64_t ret = n;
  for(int64_t i = 2; i * i <= n; i++) {
    if(n % i == 0) {
      ret -= ret / i;
      while(n % i == 0) n /= i;
    }
  }
  if(n > 1) ret -= ret / n;
  return ret;
}

int main(){
  int n;
  cin>>n;
  cout<<euler_phi(n)<<'\n';
  return(0);
}
