#include <bits/stdc++.h>
long Bigmod(long b, long p, long m) {
  if (p == 0)
    return 1;
  else if (p % 2 == 0)
    return (Bigmod(b, p / 2, m) * Bigmod(b, p / 2, m)) % m;
  else
    return ((b % m) * Bigmod(b, p - 1, m)) % m;
}
int main() {
  long n, i, j, k, ans = 0, p;
  scanf("%ld", &p);
  for (i = 1; i < p; i++) {
    n = Bigmod(i, p - 1, p);
    n = (n - 1 + p) % p;
    if (!n) {
      for (j = 1; j <= p - 2; j++) {
        k = Bigmod(i, j, p);
        k = (k - 1 + p) % p;
        if (!k) break;
      }
      ans += (j > (p - 2));
    }
  }
  printf("%ld\n", ans);
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

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, 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 <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>.

Examples

Input

3


Output

1


Input

5


Output

2

Note

The only primitive root <image> is 2.

The primitive roots <image> are 2 and 3.

### Response

```cpp
#include <bits/stdc++.h>
long Bigmod(long b, long p, long m) {
  if (p == 0)
    return 1;
  else if (p % 2 == 0)
    return (Bigmod(b, p / 2, m) * Bigmod(b, p / 2, m)) % m;
  else
    return ((b % m) * Bigmod(b, p - 1, m)) % m;
}
int main() {
  long n, i, j, k, ans = 0, p;
  scanf("%ld", &p);
  for (i = 1; i < p; i++) {
    n = Bigmod(i, p - 1, p);
    n = (n - 1 + p) % p;
    if (!n) {
      for (j = 1; j <= p - 2; j++) {
        k = Bigmod(i, j, p);
        k = (k - 1 + p) % p;
        if (!k) break;
      }
      ans += (j > (p - 2));
    }
  }
  printf("%ld\n", ans);
  return 0;
}

```