#include <bits/stdc++.h>
using namespace std;
int inp[2020];
vector<int> prime;
map<int, int> M;
map<int, int>::iterator it;
void seive() {
  bool p[2020];
  for (int i = 0; i < 2020; ++i) p[i] = 1;
  p[0] = p[1] = 0;
  for (int i = 2; i < 2020; ++i) {
    if (!p[i]) continue;
    prime.push_back(i);
    for (int j = i * i; j < 2020; j += i) p[j] = 0;
  }
}
void calc(int n) {
  M.clear();
  for (int i = 0; i < prime.size() && n != 1; ++i) {
    if (n % prime[i] == 0) {
      M[prime[i]] = 0;
      while (n % prime[i] == 0) {
        ++M[prime[i]];
        n /= prime[i];
      }
    }
  }
}
int main() {
  seive();
  int n;
  while (cin >> n) {
    calc(n - 1);
    int ans = 0;
    int t = n - 1;
    for (it = M.begin(); it != M.end(); ++it) ans += ((t - ans) / it->first);
    cout << n - ans - 1 << endl;
  }
}

### Prompt

Create a solution in Cpp for the following problem:

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;
int inp[2020];
vector<int> prime;
map<int, int> M;
map<int, int>::iterator it;
void seive() {
  bool p[2020];
  for (int i = 0; i < 2020; ++i) p[i] = 1;
  p[0] = p[1] = 0;
  for (int i = 2; i < 2020; ++i) {
    if (!p[i]) continue;
    prime.push_back(i);
    for (int j = i * i; j < 2020; j += i) p[j] = 0;
  }
}
void calc(int n) {
  M.clear();
  for (int i = 0; i < prime.size() && n != 1; ++i) {
    if (n % prime[i] == 0) {
      M[prime[i]] = 0;
      while (n % prime[i] == 0) {
        ++M[prime[i]];
        n /= prime[i];
      }
    }
  }
}
int main() {
  seive();
  int n;
  while (cin >> n) {
    calc(n - 1);
    int ans = 0;
    int t = n - 1;
    for (it = M.begin(); it != M.end(); ++it) ans += ((t - ans) / it->first);
    cout << n - ans - 1 << endl;
  }
}

```