#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 0;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
const int N = 10000005;
int mu[N], flag[N], p[N], c[N], s[N], n, cnt, x;
long long ans, num, sum;
void init() {
  mu[1] = 1;
  for (int i = (2); i <= (n); i++) {
    if (!flag[i]) {
      p[++cnt] = i, mu[i] = -1;
      if (i * 2 <= n) num++, c[i]++;
    }
    for (int j = 1; j <= cnt && i * p[j] <= n; j++) {
      flag[i * p[j]] = 1;
      c[p[j]]++, num++;
      if (i % p[j] == 0) {
        mu[i * p[j]] = 0;
        break;
      }
      mu[i * p[j]] = -mu[i];
    }
  }
  for (int i = (2); i <= (n); i++) s[i] = s[i - 1] + c[i];
}
int main() {
  read(n), init();
  ans = 3 * num * (num - 1) / 2;
  for (int i = 2; i < n / i; i++)
    if (c[i]) ans -= (long long)c[i] * (s[n / i] - s[i]);
  for (int i = (1); i <= (n); i++) {
    if (c[i]) ans -= (long long)c[i] * (c[i] - 1) / 2;
    if (mu[i]) {
      x = n / i;
      sum += (long long)mu[i] * x * (x - 1) / 2;
    }
  }
  ans -= (long long)n * (n - 1) / 2 - sum;
  cout << ans << endl;
  return 0;
}

### Prompt

Please formulate a CPP solution to the following problem:

You are given a positive integer n. Let's build a graph on vertices 1, 2, ..., n in such a way that there is an edge between vertices u and v if and only if <image>. Let d(u, v) be the shortest distance between u and v, or 0 if there is no path between them. Compute the sum of values d(u, v) over all 1 ≤ u < v ≤ n.

The gcd (greatest common divisor) of two positive integers is the maximum positive integer that divides both of the integers.

Input

Single integer n (1 ≤ n ≤ 107).

Output

Print the sum of d(u, v) over all 1 ≤ u < v ≤ n.

Examples

Input

6


Output

8


Input

10


Output

44

Note

All shortest paths in the first example: 

  * <image>
  * <image>
  * <image>
  * <image>
  * <image>
  * <image>



There are no paths between other pairs of vertices.

The total distance is 2 + 1 + 1 + 2 + 1 + 1 = 8.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 0;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
const int N = 10000005;
int mu[N], flag[N], p[N], c[N], s[N], n, cnt, x;
long long ans, num, sum;
void init() {
  mu[1] = 1;
  for (int i = (2); i <= (n); i++) {
    if (!flag[i]) {
      p[++cnt] = i, mu[i] = -1;
      if (i * 2 <= n) num++, c[i]++;
    }
    for (int j = 1; j <= cnt && i * p[j] <= n; j++) {
      flag[i * p[j]] = 1;
      c[p[j]]++, num++;
      if (i % p[j] == 0) {
        mu[i * p[j]] = 0;
        break;
      }
      mu[i * p[j]] = -mu[i];
    }
  }
  for (int i = (2); i <= (n); i++) s[i] = s[i - 1] + c[i];
}
int main() {
  read(n), init();
  ans = 3 * num * (num - 1) / 2;
  for (int i = 2; i < n / i; i++)
    if (c[i]) ans -= (long long)c[i] * (s[n / i] - s[i]);
  for (int i = (1); i <= (n); i++) {
    if (c[i]) ans -= (long long)c[i] * (c[i] - 1) / 2;
    if (mu[i]) {
      x = n / i;
      sum += (long long)mu[i] * x * (x - 1) / 2;
    }
  }
  ans -= (long long)n * (n - 1) / 2 - sum;
  cout << ans << endl;
  return 0;
}

```