#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>

using namespace std;

//Nayeem Shahriar Joy,Applied Physics And Electronic Engineering,University of Rajshahi.

unsigned long long int phie( long long int n)

{
    int result =n;
    for(int p=2;p*p<=n;++p)
    {
        if(n%p==0)
        {
            while(n%p==0)
            {
                n=n/p;
            }
            result=result-(result/p);
        }
    }
    if(n>1)
    {
        result=result-(result/n);
    }
    return result;
}

int main()
{
    long long int n;
    cin>>n;
    cout<<phie(n)<<endl;
    return 0;
}