#include<iostream>
using namespace std;long long e(long long n){long long r=n;for(long long i=2;i*i<=n;i++)if(n%i==0){r-=r/i;while(n%i== 0)n/=i;}if (n > 1) r -= r / n;return r;}int main(){long long n;cin>>n;cout<<e(n)<<endl;}