Codeforces Round 174 (Div. 2)
A
Cows and Primitive Roots
Codeforces
1400
原题
←B →
翻译中…

The cows have just learned what a primitive root is! Given a prime $*p*$, a primitive root image is an integer $*x*$ $(1 ≤ *x* < *p*)$ such that none of integers $*x* - 1, *x*^{2} - 1, ..., *x*^{*p* - 2} - 1$ are divisible by $*p*$, but $*x*^{*p* - 1} - 1$ is.

翻译中…

Unfortunately, computing primitive roots can be time consuming, so the cows need your help. Given a prime $*p*$, help the cows find the number of primitive roots image.

翻译中…

Input

翻译中…

The input contains a single line containing an integer $*p*$ $(2 ≤ *p* < 2000)$. It is guaranteed that $*p*$ is a prime.

翻译中…

Output

翻译中…

Output on a single line the number of primitive roots image.

翻译中…

Note

翻译中…

The only primitive root image is $2.$

翻译中…

The primitive roots image are $2$ and $3.$

翻译中…

样例

Input #1
3
Output #1
1
InputCopy OutputCopy
Input #2
5
Output #2
2
InputCopy OutputCopy
题目信息
题号
284A
时间限制
2 s
内存限制
256 MB
标签
模拟
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。