#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll MOD = 1000000007;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, ans = 0, w, l;
vl A;
map<ll, ll> insuu;
vl IN;
void insuubunkai(ll n) {
	a = n;
	for (ll i = 2; i * i <= a; i++) {
		if (a % i == 0) {
			insuu[i] = 0;
			IN.push_back(i);
			while (a % i == 0) {
				insuu[i]++;
				a = a / i;
			}
		}
	}

	if (a != 1) {
		insuu[a]++;
		IN.push_back(a);
	}
}
void input() {
	cin >> n;
	insuubunkai(n);
	ans = 0;
	for (ll i=1; i < (1 << IN.size());i++) {
		b = 1;
		k = 0;
		rep(j, IN.size()) {
			if (i & (1 << j)) {
				b *= IN[j];
				k++;
			}
		}
		if(k%2==1)ans += n / b;
		else ans -= n / b;
		//cout << i << " " << ans << endl;
	}

	ans = n - ans;
	cout << ans << endl;
}


void solve() {
	
}

int main() {
	input();
	solve();
}
