#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return power(x, y / 2) * power(x, y / 2);
  else
    return x * power(x, y / 2) * power(x, y / 2);
}
long long bigpower(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long at[2003];
int main() {
  long long n;
  cin >> n;
  long long i;
  long long count = 0;
  long long count1 = 0;
  if (n == 2) {
    cout << "1";
    return 0;
  }
  for (i = 2; i <= n; i++) {
    memset(at, 0, sizeof(at));
    count = 0;
    for (long long j = 0;; j++) {
      long long g = bigpower(i, j, n);
      if (g == 0) break;
      if (at[g] == 0) {
        at[g] = 1;
        count++;
      } else {
        if (count == n - 1) count1++;
        break;
      }
    }
  }
  cout << count1;
  return 0;
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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 power(long long x, long long y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return power(x, y / 2) * power(x, y / 2);
  else
    return x * power(x, y / 2) * power(x, y / 2);
}
long long bigpower(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long at[2003];
int main() {
  long long n;
  cin >> n;
  long long i;
  long long count = 0;
  long long count1 = 0;
  if (n == 2) {
    cout << "1";
    return 0;
  }
  for (i = 2; i <= n; i++) {
    memset(at, 0, sizeof(at));
    count = 0;
    for (long long j = 0;; j++) {
      long long g = bigpower(i, j, n);
      if (g == 0) break;
      if (at[g] == 0) {
        at[g] = 1;
        count++;
      } else {
        if (count == n - 1) count1++;
        break;
      }
    }
  }
  cout << count1;
  return 0;
}

```