/*
1~nまでの自然数のうち、nと互いに素なものの個数を返す
verify:
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_D&lang=jp
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;

ll EulerPhi(ll n){
    ll ret=n;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            while(n%i==0) n/=i;
            ret-=ret/i;
        }
    }
    if(n>1) ret-=ret/n;
    return ret;
}

signed main(){
    ll n;
    cin>>n;
    cout<<EulerPhi(n)<<endl;
}
