#include <bits/stdc++.h>
using namespace std;
int divv[10000005], n;
long long ans[10000005];
int prr[10000005], c;
int f[256];
int main() {
  cin >> n;
  for (int i = 0; i < 256; i++) f[i] = __builtin_popcount(i);
  for (int i = 2; i <= 10000000; i++) {
    if (divv[i] != 0) continue;
    if (i * 2 <= n) {
      prr[c++] = i;
    }
    for (int j = i * 2; j <= 10000000; j += i) {
      divv[j] = i;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (divv[i] == 0) {
      if (i * 2 > n) continue;
      long long x = i;
      long long y = max(x, n / x);
      int d = upper_bound(prr, prr + c, y) - prr;
      ans[i] -= (c - d) * 2;
      ans[i] += n / i - 1;
    } else if (divv[i / divv[i]] == divv[i]) {
      ans[i] = ans[i / divv[i]];
    } else {
      int pr[11];
      int nxt = 0, cur = i;
      while (divv[cur] != 0) {
        if (nxt == 0 || pr[nxt - 1] != divv[cur]) {
          pr[nxt++] = divv[cur];
        }
        cur = cur / divv[cur];
      }
      if (nxt == 0 || pr[nxt - 1] != cur) {
        pr[nxt++] = cur;
      }
      long long sum = 0;
      for (int mask = 1; mask < (1 << nxt); mask++) {
        int a = f[mask];
        long long D = 1;
        for (int k = 0; k < nxt; k++)
          if (((mask >> k) & 1)) D = D * pr[k];
        if (a % 2 == 1)
          sum += n / D;
        else
          sum -= n / D;
      }
      long long x = pr[nxt - 1];
      long long y = max(x, n / x);
      int d = upper_bound(prr, prr + c, y) - prr;
      ans[i] -= (c - d) * 2;
      ans[i] += sum - 1;
    }
  }
  long long comp = 0, ret = 0;
  for (int i = 2; i <= n; i++) {
    if (i * 2 > n && divv[i] == 0) continue;
    comp++;
    ret += ans[i];
  }
  comp = comp * (comp - 1) / 2;
  ret /= 2;
  cout << comp * 2 - ret << endl;
}

### 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;
int divv[10000005], n;
long long ans[10000005];
int prr[10000005], c;
int f[256];
int main() {
  cin >> n;
  for (int i = 0; i < 256; i++) f[i] = __builtin_popcount(i);
  for (int i = 2; i <= 10000000; i++) {
    if (divv[i] != 0) continue;
    if (i * 2 <= n) {
      prr[c++] = i;
    }
    for (int j = i * 2; j <= 10000000; j += i) {
      divv[j] = i;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (divv[i] == 0) {
      if (i * 2 > n) continue;
      long long x = i;
      long long y = max(x, n / x);
      int d = upper_bound(prr, prr + c, y) - prr;
      ans[i] -= (c - d) * 2;
      ans[i] += n / i - 1;
    } else if (divv[i / divv[i]] == divv[i]) {
      ans[i] = ans[i / divv[i]];
    } else {
      int pr[11];
      int nxt = 0, cur = i;
      while (divv[cur] != 0) {
        if (nxt == 0 || pr[nxt - 1] != divv[cur]) {
          pr[nxt++] = divv[cur];
        }
        cur = cur / divv[cur];
      }
      if (nxt == 0 || pr[nxt - 1] != cur) {
        pr[nxt++] = cur;
      }
      long long sum = 0;
      for (int mask = 1; mask < (1 << nxt); mask++) {
        int a = f[mask];
        long long D = 1;
        for (int k = 0; k < nxt; k++)
          if (((mask >> k) & 1)) D = D * pr[k];
        if (a % 2 == 1)
          sum += n / D;
        else
          sum -= n / D;
      }
      long long x = pr[nxt - 1];
      long long y = max(x, n / x);
      int d = upper_bound(prr, prr + c, y) - prr;
      ans[i] -= (c - d) * 2;
      ans[i] += sum - 1;
    }
  }
  long long comp = 0, ret = 0;
  for (int i = 2; i <= n; i++) {
    if (i * 2 > n && divv[i] == 0) continue;
    comp++;
    ret += ans[i];
  }
  comp = comp * (comp - 1) / 2;
  ret /= 2;
  cout << comp * 2 - ret << endl;
}

```