#include <bits/stdc++.h>

using namespace std;

long long eulerPhi(long long n) {
    if (n == 0) return 0;
    long long res = n;
    for (long x = 2; x * x <= n; ++x) {
        if (n % x == 0) {
            res -= res / x;
            while (n % x == 0) n /= x;
        }
    }
    if (n > 1) res -= res / n;
    return res;
}


int main() {
    long long n;
    cin >> n;

    cout << eulerPhi(n) << endl;
    return 0;
}
