Preparando MOJI

Cows and Primitive Roots

2000ms 262144K

Description:

The cows have just learned what a primitive root is! Given a prime p, a primitive root is an integer x (1 ≤ x < p) such that none of integers x - 1, x2 - 1, ..., xp - 2 - 1 are divisible by p, but xp - 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 .

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 .

Sample Input:

3

Sample Output:

1

Sample Input:

5

Sample Output:

2

Note:

The only primitive root is 2.

The primitive roots are 2 and 3.

Informação

Codeforces

Provedor Codeforces

Código CF284A

Tags

implementationmathnumber theory

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 08:42:44

Relacionados

Nada ainda