#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"

map<long long int, int>soinnsuu(long long int a) {
	map<long long int, int>ans;
	for (long long i = 2; i*i <= a; ++i) {
		while (a%i == 0) {
			ans[i]++;
			a /= i;
		}
	}
	if (a != 1)ans[a]++;
	return ans;
}
int main() {
	int N; cin >> N;
	auto mp(soinnsuu(N));
	bitset<30>bs;
	int size_ = mp.size();
	vector<long long int>sos;
	for (auto m : mp)sos.emplace_back(m.first);
	int ans = 0;
	for (int i = 0; i < (1 << size_); ++i) {
		bitset<30>bs(i);
		int num = N;
		for (int j = 0; j < size_; ++j) {
			if (bs[j]) {
				num /= sos[j];
			}
		}
		if (bs.count()%2)ans -= num;
		else ans += num;
	}
	cout << ans << endl;
	return 0;
}