#include <iostream>
#include <cmath>
using namespace std;

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

		long long n1 = n;

		long long temp = n;
		for (long long i = 2; i <= sqrt(n1); i++) {
				if (n % i == 0) {
						temp = temp * (i - 1) / i;
						while(n % i == 0) {
								n /= i;
						}
				}
		}
		if (n > 1) {
				temp = temp *  (n - 1) / n;
		}

		cout << temp << endl;

		return 0;
}