#include <bits/stdc++.h>
#pragma comment(linker, "/stack:640000000")
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI = acos(-1.0);
template <class T>
inline T gcd(T a, T b) {
  return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template <class T>
inline T lcm(T a, T b) {
  return ((a) / gcd((a), (b)) * (b));
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
int t, n, m;
long long bigmod(long long b, long long p, long long m) {
  long long res = 1 % m, x = b % m;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
long long modularInverse(int a, int m) { return bigmod(a, m - 2, m); }
int main() {
  while (~scanf("%d", &n)) {
    int ans = 0;
    for (int i = 1; i <= (n - 1); i++) {
      int found = 0;
      for (int j = 1; j <= (n - 2); j++) {
        long long sum = bigmod(i, j, n);
        if (sum == 1) found = 1;
      }
      if (!found) {
        long long sum = bigmod(i, n - 1, n);
        if (sum == 1) ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

### 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>
#pragma comment(linker, "/stack:640000000")
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI = acos(-1.0);
template <class T>
inline T gcd(T a, T b) {
  return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template <class T>
inline T lcm(T a, T b) {
  return ((a) / gcd((a), (b)) * (b));
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
int t, n, m;
long long bigmod(long long b, long long p, long long m) {
  long long res = 1 % m, x = b % m;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
long long modularInverse(int a, int m) { return bigmod(a, m - 2, m); }
int main() {
  while (~scanf("%d", &n)) {
    int ans = 0;
    for (int i = 1; i <= (n - 1); i++) {
      int found = 0;
      for (int j = 1; j <= (n - 2); j++) {
        long long sum = bigmod(i, j, n);
        if (sum == 1) found = 1;
      }
      if (!found) {
        long long sum = bigmod(i, n - 1, n);
        if (sum == 1) ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

```