Skip to content
UPEEC

Euler's Totient

Hard#math#number-theory#primes· solved by 0 · time limit 2.0 s

φ(n)\varphi(n) counts the integers 1≤k≤n1 \le k \le n with gcd⁡(k,n)=1\gcd(k, n) = 1. Print φ(n)\varphi(n).

Use φ(n)=n∏p∣n(1−1p)\varphi(n) = n \prod_{p \mid n} \left(1 - \frac1p\right) over the distinct primes dividing nn.

Input

A single integer nn.

Output

φ(n)\varphi(n)

Constraints

1≤n≤10121 \le n \le 10^{12}

Sample 1

Input

9

Output

6

Sample 2

Input

1

Output

1

Sign in or join free to run and submit your solution.