#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e+7 + 10;
bool isnotp[maxn];
long long u[maxn];
long long p[664599], pn;
long long cnt[664599], sum[664599];
long long n, ans;
void pre() {
  int i, j;
  for (i = 2; i <= n; i++) {
    if (!isnotp[i]) {
      p[pn] = i;
      u[i] = cnt[pn++] = 1;
    }
    for (j = 0; j < pn && i * p[j] <= n; j++) {
      isnotp[i * p[j]] = true;
      u[i * p[j]] = -u[i];
      cnt[j]++;
      if (!(i % p[j])) {
        u[i * p[j]] = 0;
        break;
      }
    }
  }
  cerr << pn << endl;
  sum[0] = cnt[0];
  for (i = 1; i < pn; i++) sum[i] = sum[i - 1] + cnt[i];
}
void solve() {
  long long i, j, pos, tsum;
  ans = 0;
  for (i = 0; i < pn; i++) {
    ans += cnt[i] * (cnt[i] - 1);
    for (j = i + 1; j < pn && p[j] * p[i] <= n; j++) ans += cnt[i] * cnt[j] * 2;
  }
  for (i = 2; i <= n; i++)
    if (u[i]) {
      ans -= u[i] * (n / i) * (n / i - 1) / 2;
    }
  for (pos = 0; p[pos] <= n / 2; pos++)
    ;
  j = --pos;
  for (i = 1; i < pn && p[i] <= n / 2; i++) {
    for (; j >= 0 && p[j] * p[i] > n; j--)
      ;
    ans += cnt[i] * (sum[pos] - sum[max(j, i)]) * 3;
  }
  cout << ans << endl;
}
int main() {
  cin >> n;
  pre();
  solve();
  return 0;
}

### Prompt

In Cpp, your task is to solve 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 = 1e+7 + 10;
bool isnotp[maxn];
long long u[maxn];
long long p[664599], pn;
long long cnt[664599], sum[664599];
long long n, ans;
void pre() {
  int i, j;
  for (i = 2; i <= n; i++) {
    if (!isnotp[i]) {
      p[pn] = i;
      u[i] = cnt[pn++] = 1;
    }
    for (j = 0; j < pn && i * p[j] <= n; j++) {
      isnotp[i * p[j]] = true;
      u[i * p[j]] = -u[i];
      cnt[j]++;
      if (!(i % p[j])) {
        u[i * p[j]] = 0;
        break;
      }
    }
  }
  cerr << pn << endl;
  sum[0] = cnt[0];
  for (i = 1; i < pn; i++) sum[i] = sum[i - 1] + cnt[i];
}
void solve() {
  long long i, j, pos, tsum;
  ans = 0;
  for (i = 0; i < pn; i++) {
    ans += cnt[i] * (cnt[i] - 1);
    for (j = i + 1; j < pn && p[j] * p[i] <= n; j++) ans += cnt[i] * cnt[j] * 2;
  }
  for (i = 2; i <= n; i++)
    if (u[i]) {
      ans -= u[i] * (n / i) * (n / i - 1) / 2;
    }
  for (pos = 0; p[pos] <= n / 2; pos++)
    ;
  j = --pos;
  for (i = 1; i < pn && p[i] <= n / 2; i++) {
    for (; j >= 0 && p[j] * p[i] > n; j--)
      ;
    ans += cnt[i] * (sum[pos] - sum[max(j, i)]) * 3;
  }
  cout << ans << endl;
}
int main() {
  cin >> n;
  pre();
  solve();
  return 0;
}

```