#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int eulerPhi(int n){
	int out=n;
	for(int i=2;i*i<=n;i++){
		if(n%i==0){
			out-=out/i;
			while(n%i==0)n/=i;
		}
	}
	if(n>1)out-=out/n;
	return out;
}
int main(){
	int n;
	cin>>n;
	cout<<eulerPhi(n)<<endl;
}