#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	ll n;
	cin >> n;
	vector<ll> factor;
	ll tmp = n;
	for (ll i = 2; i*i <= tmp; i++) {
		int k = 0;
		while (tmp%i == 0) {
			tmp /= i;
			k++;
		}
		if (k > 0) factor.push_back(i);
	}
	if (tmp > 1) factor.push_back(tmp);
	ll ans = 0;
	for (int bit = 0; bit < (1 << factor.size()); bit++) {
		ll mul = 1;
		int cnt = 0;
		for (int i = 0; i < factor.size(); i++) {
			if (bit&(1 << i)) {
				mul *= factor[i];
				cnt++;
			}
		}
		if (cnt % 2 == 0) ans += n / mul;
		else ans -= n / mul;
	}
	cout << ans << endl;
 }
