#include <bits/stdc++.h>
using namespace std;

int Euler_Phi(int n) {
	int res = n;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			res = res / i * (i - 1);
			while (n /= i, n % i == 0);
		}
	}
	if (n != 1) res = res / n * (n - 1);
	return res;
}

int main()
{
	int n;
	cin >> n;
	cout << Euler_Phi(n) << endl;
	return 0;
}