#include <bits/stdc++.h>
using namespace std;
long long int prime(long long int n) {
  long long int c = 0;
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) c++;
    if (c == 1) break;
  }
  return c;
}
long long int qp(long long int a, long long int b, long long int mod) {
  long long int res = 1;
  if (b == 0) return 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b = b >> 1;
  }
  return res;
}
int main() {
  long long int t, n, m, i, j, p, q, r, x, y, z, k = 0, l = 0, ans = 0;
  cin >> n;
  for (i = 1; i < n; i++) {
    k = 0;
    for (j = 1; j < n - 1; j++) {
      x = qp(i, j, n) - 1;
      if (x % n == 0) {
        k = 1;
        break;
      }
    }
    x = qp(i, n - 1, n) - 1;
    if (x % n != 0) k = 1;
    if (k == 0) ans++;
  }
  cout << ans;
}

### Prompt

Please provide a cpp coded solution 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>
using namespace std;
long long int prime(long long int n) {
  long long int c = 0;
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) c++;
    if (c == 1) break;
  }
  return c;
}
long long int qp(long long int a, long long int b, long long int mod) {
  long long int res = 1;
  if (b == 0) return 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b = b >> 1;
  }
  return res;
}
int main() {
  long long int t, n, m, i, j, p, q, r, x, y, z, k = 0, l = 0, ans = 0;
  cin >> n;
  for (i = 1; i < n; i++) {
    k = 0;
    for (j = 1; j < n - 1; j++) {
      x = qp(i, j, n) - 1;
      if (x % n == 0) {
        k = 1;
        break;
      }
    }
    x = qp(i, n - 1, n) - 1;
    if (x % n != 0) k = 1;
    if (k == 0) ans++;
  }
  cout << ans;
}

```