#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e7 + 500;
bool flag[maxn];
int n, phi[maxn], pri[maxn], e[maxn], f[maxn], cnt = 0;
void Get_phi() {
  phi[1] = 1;
  for (int i = 2; i < maxn; i++) {
    if (!flag[i]) {
      pri[cnt++] = i;
      phi[i] = i - 1;
      e[i] = i;
    }
    for (int j = 0; j < cnt; j++) {
      if (1LL * i * pri[j] > maxn) break;
      flag[i * pri[j]] = true;
      e[i * pri[j]] = pri[j];
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = pri[j] * phi[i];
        break;
      } else
        phi[i * pri[j]] = (pri[j] - 1) * phi[i];
    }
  }
}
int lowbit(int t) { return t & (-t); }
void add(int x) {
  while (x <= n) {
    f[x] += 1;
    x += lowbit(x);
  }
}
int ff(int x) {
  int s = 0;
  while (x > 0) {
    s += f[x];
    x -= lowbit(x);
  }
  return s;
}
int main() {
  int i, j;
  long long ans = 0;
  Get_phi();
  scanf("%d", &n);
  for (i = 2, j = 0; i <= n; i++) {
    if (e[i] * 2 <= n) {
      ans += 3LL * j - ff(n / e[i]) - i + phi[i] + 1;
      j++;
      add(e[i]);
    }
  }
  printf("%lld\n", ans);
  return 0;
}

### Prompt

Please provide a Cpp coded solution 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>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e7 + 500;
bool flag[maxn];
int n, phi[maxn], pri[maxn], e[maxn], f[maxn], cnt = 0;
void Get_phi() {
  phi[1] = 1;
  for (int i = 2; i < maxn; i++) {
    if (!flag[i]) {
      pri[cnt++] = i;
      phi[i] = i - 1;
      e[i] = i;
    }
    for (int j = 0; j < cnt; j++) {
      if (1LL * i * pri[j] > maxn) break;
      flag[i * pri[j]] = true;
      e[i * pri[j]] = pri[j];
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = pri[j] * phi[i];
        break;
      } else
        phi[i * pri[j]] = (pri[j] - 1) * phi[i];
    }
  }
}
int lowbit(int t) { return t & (-t); }
void add(int x) {
  while (x <= n) {
    f[x] += 1;
    x += lowbit(x);
  }
}
int ff(int x) {
  int s = 0;
  while (x > 0) {
    s += f[x];
    x -= lowbit(x);
  }
  return s;
}
int main() {
  int i, j;
  long long ans = 0;
  Get_phi();
  scanf("%d", &n);
  for (i = 2, j = 0; i <= n; i++) {
    if (e[i] * 2 <= n) {
      ans += 3LL * j - ff(n / e[i]) - i + phi[i] + 1;
      j++;
      add(e[i]);
    }
  }
  printf("%lld\n", ans);
  return 0;
}

```