#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (double i = (a); i < (b); i++)
typedef long long ll;

ll gcd(ll a, ll b)//最大公約数
{
  return b != 0 ? gcd(b, a % b) : a;
}


int main(void)
{
    int n;
    cin >> n;
    double ans = n;
    repd(i, 2, n+1)
    {
        if(n % (int)i == 0)
        {
            while(n % (int)i == 0)
            {
                n /= i;
            }
            ans *= (1 - 1/i);
        }
        //cout << ans << endl;
    }
    cout << (int)ans << endl;
}

