#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

vector<int> prime_factors(ll n){
	vector<int> ret;
	for(int i = 2; i * i <= n; ++i){
		if(n % i == 0){
			ret.push_back(i);
			while(n % i == 0)n /= i;
		}
	}
	if(n != 1)ret.push_back(n);
	return ret;
}

int main(){
  ll n;
  cin >> n;

  auto factors = prime_factors(n);
  int m = factors.size();
  ll ans = 0;
  for(int b = 1; b < (1 << m); ++b){
  	ll mul = 1;
  	int cnt = 0;
  	for(int i = 0; i < m; ++i){
  		if(b >> i & 1){
  			mul *= factors[i];
  			++cnt;
  		}
  	}
  	if(cnt % 2)ans += n / mul;
  	else ans -= n / mul;
  }

  cout << n - ans << endl;
  return 0;
}


