#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)(1e7) + 5;
int pr[maxn], mu[maxn], smu[maxn], f[maxn];
bool chk[maxn];
int n, tot;
void gen() {
  mu[1] = smu[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!chk[i]) {
      pr[++tot] = i;
      f[i] = 1;
      mu[i] = -1;
    }
    for (int j = 1; j <= tot; ++j) {
      if (i * pr[j] > n) break;
      ++f[pr[j]];
      chk[i * pr[j]] = 1;
      mu[i * pr[j]] = -mu[i];
      if (i % pr[j] == 0) {
        mu[i * pr[j]] = 0;
        break;
      }
    }
    smu[i] = smu[i - 1] + mu[i];
  }
}
int main() {
  scanf("%d", &n);
  gen();
  long long A = 1LL * n * (n - 1), B = 0, C = 0, S = 0;
  for (int i = 1, ps; i <= n; i = ps + 1) {
    ps = n / (n / i);
    A -= 1LL * (n / i) * (n / i) * (smu[ps] - smu[i - 1]);
  }
  A = (A + 1) / 2;
  for (int i = 2; i <= n; ++i)
    if (!chk[i])
      for (int k = i, j = 1; k <= n; k += i, ++j)
        if (j > 1 && !chk[j]) B += 1LL * f[i] * f[j];
  for (int i = 2; i * i <= n; ++i)
    if (!chk[i]) B -= f[i];
  B = B / 2 - A;
  for (int i = 2; i <= (n >> 1); ++i)
    if (!chk[i]) C += 1LL * f[i] * (f[i] - 1) + S * f[i], S += 2LL * f[i];
  C = C / 2 - A - B;
  printf("%I64d\n", A + B * 2 + C * 3);
  return 0;
}

### Prompt

Your challenge is to write 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;
const int maxn = (int)(1e7) + 5;
int pr[maxn], mu[maxn], smu[maxn], f[maxn];
bool chk[maxn];
int n, tot;
void gen() {
  mu[1] = smu[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!chk[i]) {
      pr[++tot] = i;
      f[i] = 1;
      mu[i] = -1;
    }
    for (int j = 1; j <= tot; ++j) {
      if (i * pr[j] > n) break;
      ++f[pr[j]];
      chk[i * pr[j]] = 1;
      mu[i * pr[j]] = -mu[i];
      if (i % pr[j] == 0) {
        mu[i * pr[j]] = 0;
        break;
      }
    }
    smu[i] = smu[i - 1] + mu[i];
  }
}
int main() {
  scanf("%d", &n);
  gen();
  long long A = 1LL * n * (n - 1), B = 0, C = 0, S = 0;
  for (int i = 1, ps; i <= n; i = ps + 1) {
    ps = n / (n / i);
    A -= 1LL * (n / i) * (n / i) * (smu[ps] - smu[i - 1]);
  }
  A = (A + 1) / 2;
  for (int i = 2; i <= n; ++i)
    if (!chk[i])
      for (int k = i, j = 1; k <= n; k += i, ++j)
        if (j > 1 && !chk[j]) B += 1LL * f[i] * f[j];
  for (int i = 2; i * i <= n; ++i)
    if (!chk[i]) B -= f[i];
  B = B / 2 - A;
  for (int i = 2; i <= (n >> 1); ++i)
    if (!chk[i]) C += 1LL * f[i] * (f[i] - 1) + S * f[i], S += 2LL * f[i];
  C = C / 2 - A - B;
  printf("%I64d\n", A + B * 2 + C * 3);
  return 0;
}

```