#include <bits/stdc++.h>
using namespace std;
float PHI = 1.6180339;
const float PI_F = 3.14159265358979f;
long long modpow(long long x, long long n, long long m) {
  if (n == 0) return 1 % m;
  long long u = modpow(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2 == 1) u = (u * x) % m;
  return u;
}
long long add(long long x, long long y) {
  x += y;
  if (x >= 1000000007) return x - 1000000007;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + 1000000007;
  return x;
}
long long inv(long long a, long long m = 998244353) {
  return modpow(a, m - 2, m);
}
long long mul(long long a, long long b) { return (long long)a * b % 998244353; }
long long nCrModp(long long n, long long r, long long p) {
  long long C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cout << fixed << setprecision(12);
  long long p;
  cin >> p;
  long long cnt = 0;
  for (long long i = 1; i <= p; i++) {
    long long flag = 1;
    for (long long j = 1; j <= p - 2; j++) {
      long long val = modpow(i, j, p);
      val -= 1;
      if (val % p == 0) {
        flag = 0;
        break;
      }
    }
    if (flag == 1) {
      long long val = modpow(i, p - 1, p);
      val -= 1;
      if (val % p != 0) {
        flag = 0;
      }
    }
    if (flag == 1) {
      ++cnt;
    }
  }
  cout << cnt << "\n";
  return 0;
}

### Prompt

Please formulate a cpp solution to 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;
float PHI = 1.6180339;
const float PI_F = 3.14159265358979f;
long long modpow(long long x, long long n, long long m) {
  if (n == 0) return 1 % m;
  long long u = modpow(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2 == 1) u = (u * x) % m;
  return u;
}
long long add(long long x, long long y) {
  x += y;
  if (x >= 1000000007) return x - 1000000007;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + 1000000007;
  return x;
}
long long inv(long long a, long long m = 998244353) {
  return modpow(a, m - 2, m);
}
long long mul(long long a, long long b) { return (long long)a * b % 998244353; }
long long nCrModp(long long n, long long r, long long p) {
  long long C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cout << fixed << setprecision(12);
  long long p;
  cin >> p;
  long long cnt = 0;
  for (long long i = 1; i <= p; i++) {
    long long flag = 1;
    for (long long j = 1; j <= p - 2; j++) {
      long long val = modpow(i, j, p);
      val -= 1;
      if (val % p == 0) {
        flag = 0;
        break;
      }
    }
    if (flag == 1) {
      long long val = modpow(i, p - 1, p);
      val -= 1;
      if (val % p != 0) {
        flag = 0;
      }
    }
    if (flag == 1) {
      ++cnt;
    }
  }
  cout << cnt << "\n";
  return 0;
}

```