#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

bool isPrime(long long n){
    if(n==1) return 0;
    for(long long i=2;i*i<=n;i++){
        if(n%i == 0){
            return 0;
        }
    }
    return 1;
}

int main() {
    int n,x=0;
    cin >> n;
    int m=n;
    int ans=m;
    int cnt[100000] = {0};
    while(n>1){
        for(int j=2;j*j<=m;j++){
            if(n % j == 0){
                while(n%j==0){
                    n /= j;
                }
                cnt[j]++;
                ans *=((double)(j-1)/j);
                break;
            }
        }
        if(isPrime(n)){
            x=n;
            bool match=false;
            for(int j=2;j*j<=m;j++){
                if(x==j && cnt[j]>0) match=true;
            }
            if(!match) ans *= ((double)(x-1)/x);
            break;
        }
    }
    
    cout << ans << endl;
}

