#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int p[10000010], pn, u[10000010], mu[10000010], phi[10000010], cnt, s[10000010];
long long ans, ans1;
int main() {
  int n;
  n = read();
  for (int i = 2; i <= n; i++) {
    if (!u[i]) p[++pn] = u[i] = i, mu[i] = -1, phi[i] = i - 1;
    for (int j = 1; i * p[j] <= n; j++) {
      u[i * p[j]] = p[j];
      if (i % p[j])
        mu[i * p[j]] = -mu[i], phi[i * p[j]] = phi[i] * (p[j] - 1);
      else {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
    }
    s[u[i]]++;
    ans += i - 1 - phi[i];
  }
  for (int i = 1; i <= pn; i++)
    if (p[i] > n / 2) cnt++;
  ans += 3 * (1ll * (n - 1) * (n - 2) / 2 - ans - 1ll * cnt * (n - 1 - cnt) -
              1ll * cnt * (cnt - 1) / 2);
  for (int i = 2; i <= n; i++) s[i] += s[i - 1];
  for (int i = 2; i <= n; i++) ans1 += 1LL * (s[i] - s[i - 1]) * s[n / i];
  for (int i = 2; i <= n; i++)
    ans1 += (1LL * (n / i) * (n / i) - (1LL * i * i > n && u[i] == i)) * mu[i];
  printf("%I64d", ans - ans1 / 2);
  return 0;
}

### Prompt

Please create a solution in Cpp 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;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int p[10000010], pn, u[10000010], mu[10000010], phi[10000010], cnt, s[10000010];
long long ans, ans1;
int main() {
  int n;
  n = read();
  for (int i = 2; i <= n; i++) {
    if (!u[i]) p[++pn] = u[i] = i, mu[i] = -1, phi[i] = i - 1;
    for (int j = 1; i * p[j] <= n; j++) {
      u[i * p[j]] = p[j];
      if (i % p[j])
        mu[i * p[j]] = -mu[i], phi[i * p[j]] = phi[i] * (p[j] - 1);
      else {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
    }
    s[u[i]]++;
    ans += i - 1 - phi[i];
  }
  for (int i = 1; i <= pn; i++)
    if (p[i] > n / 2) cnt++;
  ans += 3 * (1ll * (n - 1) * (n - 2) / 2 - ans - 1ll * cnt * (n - 1 - cnt) -
              1ll * cnt * (cnt - 1) / 2);
  for (int i = 2; i <= n; i++) s[i] += s[i - 1];
  for (int i = 2; i <= n; i++) ans1 += 1LL * (s[i] - s[i - 1]) * s[n / i];
  for (int i = 2; i <= n; i++)
    ans1 += (1LL * (n / i) * (n / i) - (1LL * i * i > n && u[i] == i)) * mu[i];
  printf("%I64d", ans - ans1 / 2);
  return 0;
}

```