#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
//by NeighThorn
using namespace std;
int n,m,ans;
signed main(void){
	scanf("%d",&n);m=sqrt(n);ans=n;
	for(int i=2;i<=m;i++)
		if(n%i==0){
			ans=ans/i*(i-1);
			while(n%i==0)
				n/=i;
		}
	if(n>1)
		ans=ans/n*(n-1);
	cout<<ans<<endl;
	return 0;
}