Time limit per test

2 seconds

Memory limit per test

256 megabytes

Input

Standard Input

Output

Standard output

The cows have just learned what a primitive root is! Given a prime*P*, A primitive root is

An integer*X*(1 digit ≤ Digit*X*Latency <latency*P*) Such

That none of Integers*X*Accept-limit 1, limit,*X*2 seconds-interval 1, interval..., interval ,...,*X**P*Invalid-limit 2 values-limit 1 are

Divisible*P*,*X**P*Invalid-limit 1 partial-limit 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 cores ≤ Cores*P*Limit <limit 2000 ).

It is guaranteed that*P*Is a prime.

Output

Output on a single line the number of Primitive Roots.

Sample test (s) Input

3

Output

1

Input

5

Output

2

Note

The only primitive root is 2.

The primitive roots are 2 and 3.

Problem description: This question is to find the maximum number of common, the meaning of the question is X-1, x ^ 2-1 ,..., the maximum common divisor of x ^ (P-2)-1 and P is 1, and x ^ (p-1)-1 can be divisible by P. This question can be simulated, but there is a simpler method on the Internet:

**Ferma's theorem is an important theorem in number theory. Its content is: if p is a prime number and (A, P) = 1, then**

**A ^ P-1) 1_1 (mod p) If P is a prime number and a and P are mutually qualitative, then the remainder of A's (PM) is equal to 1 by the remainder of P.**

**For this question, we only need to find the number of mutually qualitative numbers with the p-1's, which can satisfy the two conditions. However, we can use the Euler's function to find the number of mutually qualitative numbers with P-1's (first obtain the prime factor for the entire division of the p-1's, then bring the formula)**

#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <cstring>#include <string>#include<set>#include <algorithm>using namespace std;int gcd(int a, int b){ return b ? gcd(b, a%b) : a;}int main(){ int p,i; int ans=0; scanf("%d",&p); for(i=1; i<p; ++i) { if(gcd(p-1, i)==1){ans++;} } printf("%d\n",ans);}