#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

//	vector
template<typename T>
vector<T> trialDivision(T a) {
	vector<T> res;
	T i = 2;
	while (i * i <= a) {
		if (a % i == 0) {
			a /= i;
			res.push_back(i);
		}
		else ++i;
	}
	if (a != 1) res.push_back(a);
	return res;
}

int main() {
	int n;
	cin >> n;
	vector<int> tmp = trialDivision(n);
	tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());
	double ans = n;
	for (int& i : tmp) ans *= 1.0 - 1.0 / i;
	printf("%.f\n", ans);
}
