~/algor $ cat problems/sonlar-eyler-funksiyasi
Euler's totient function
Medium
1000 ms
128 MB
64%
You are given a positive integer $n$. Find how many of the numbers from $1$ to $n$ are coprime with $n$, that is, the numbers $k$ with $\gcd(k, n) = 1$. This number is denoted $\varphi(n)$; $\varphi(1) = 1$.
Input
One positive integer $n$.
Output
One integer — $\varphi(n)$.
Note
$1 \le n \le 10^{12}$
Examples
Input #1
12
Output #1
4
Input #2
9
Output #2
6