#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:536870912")
#pragma warning(disable : 4996)
using namespace std;
const int N = 1e7 + 100;
int s[N], phi[N], q[N], h[N];
int main() {
  for (int i = 2; i < N; i++) {
    if (!s[i]) {
      s[i] = i;
      for (long long int j = i * (long long int)i; j < N; j += i)
        if (!s[j]) s[j] = i;
    }
  }
  int n;
  scanf("%d", &n);
  long long int ans = 0;
  int t = 0, sq = 0;
  for (int i = 2; i <= n; i++) {
    if (s[i] == i)
      phi[i] = i - 1;
    else {
      phi[i] = phi[i / s[i]] * s[i];
      if (i / s[i] % s[i]) phi[i] -= phi[i] / s[i];
    }
    if (s[i] * 2 <= n) t++;
    if (s[i] * (long long int)s[i] <= n) ans++;
    q[s[i]]++;
    h[n / s[i]]++;
  }
  for (int i = 2, sum = 0; i <= n; i++) {
    sum += q[i];
    ans -= sum * (long long int)h[i];
  }
  ans /= 2;
  for (int i = 1; i <= n; i++) ans -= i - 1 - phi[i];
  ans += t * (t - 1ll) / 2 * 3;
  printf("%lld", ans);
  return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

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>
#pragma comment(linker, "/STACK:536870912")
#pragma warning(disable : 4996)
using namespace std;
const int N = 1e7 + 100;
int s[N], phi[N], q[N], h[N];
int main() {
  for (int i = 2; i < N; i++) {
    if (!s[i]) {
      s[i] = i;
      for (long long int j = i * (long long int)i; j < N; j += i)
        if (!s[j]) s[j] = i;
    }
  }
  int n;
  scanf("%d", &n);
  long long int ans = 0;
  int t = 0, sq = 0;
  for (int i = 2; i <= n; i++) {
    if (s[i] == i)
      phi[i] = i - 1;
    else {
      phi[i] = phi[i / s[i]] * s[i];
      if (i / s[i] % s[i]) phi[i] -= phi[i] / s[i];
    }
    if (s[i] * 2 <= n) t++;
    if (s[i] * (long long int)s[i] <= n) ans++;
    q[s[i]]++;
    h[n / s[i]]++;
  }
  for (int i = 2, sum = 0; i <= n; i++) {
    sum += q[i];
    ans -= sum * (long long int)h[i];
  }
  ans /= 2;
  for (int i = 1; i <= n; i++) ans -= i - 1 - phi[i];
  ans += t * (t - 1ll) / 2 * 3;
  printf("%lld", ans);
  return 0;
}

```