Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/number-theory/eulers-totient-function

Euler's totient function

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Medium 1000 ms 128 MB 64%
Share

You are given a positive integer . Find how many of the numbers from to are coprime with , that is, the numbers with . This number is denoted ; .

The numbers from one to n in a row, those coprime with n highlighted

Input

One positive integer .

Output

One integer — .

Note

Examples

Input #1
12
Output #1
4
Input #2
9
Output #2
6

Sign in to submit a solution

Signing up is free and takes a minute.