#include<iostream>
using namespace std;


int main(){
	unsigned long long int phi;
	unsigned long long int n;
	unsigned long long int i;
	
	cin >> n;
	phi = n;
	
	i=2;
	while(i<=n){
		if(n%i==0){
			n = n/i;
			phi = phi * (i-1) / i;
			
			while(n%i==0){
				n=n/i;
			}
			
		}
		++i;
	}
	
	cout << phi << endl;
	
	return 0;
}