#include <bits/stdc++.h>
using namespace std;
template <typename TP>
inline bool rd(TP& r) {
  r = 0;
  char tmp = getchar();
  while (tmp < '0' || tmp > '9') {
    if (tmp == EOF) return 0;
    tmp = getchar();
  }
  while ('0' <= tmp && tmp <= '9') {
    r = (r << 3) + (r << 1) + tmp - '0';
    tmp = getchar();
  }
  return 1;
}
int n;
bool nop[10000100];
int p[10000100], np;
int phi[10000100];
int mnp[10000100];
int mnps[10000100];
long long ans;
long long ans1, ans2, ans3;
int sum[10000100];
void primes() {
  nop[1] = 1;
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!nop[i]) {
      phi[i] = i - 1;
      p[++np] = i;
      mnp[i] = i;
      mnps[np] = 1;
      if (i * 2 <= n) ans3++;
    }
    for (int j = 1; j <= np && i * p[j] <= n; j++) {
      nop[i * p[j]] = 1;
      mnp[i * p[j]] = p[j];
      mnps[j]++;
      if (p[j] * 2 <= n) ans3++;
      if (i % p[j] != 0)
        phi[i * p[j]] = phi[i] * (p[j] - 1);
      else {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
    }
  }
  for (int i = 1; i <= np; i++) sum[i] = sum[i - 1] + mnps[i];
}
int main() {
  rd(n);
  primes();
  ans3 = ans3 * (ans3 - 1) / 2 * 3;
  long long tmp, j;
  for (int i = 2; i <= n; i++) {
    tmp = n / mnp[i];
    j = lower_bound(p + 1, p + np + 1, tmp) - p;
    if (mnp[i] * p[j] > n) j--;
    ans2 += sum[j];
    if (mnp[i] <= p[j]) ans2 -= 1;
    ans1 += i - 1 - phi[i];
  }
  ans2 /= 2;
  ans = ans3 - ans2 - ans1;
  printf("%I64d\n", ans);
  return 0;
}

### Prompt

Your challenge is to write a Cpp solution 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;
template <typename TP>
inline bool rd(TP& r) {
  r = 0;
  char tmp = getchar();
  while (tmp < '0' || tmp > '9') {
    if (tmp == EOF) return 0;
    tmp = getchar();
  }
  while ('0' <= tmp && tmp <= '9') {
    r = (r << 3) + (r << 1) + tmp - '0';
    tmp = getchar();
  }
  return 1;
}
int n;
bool nop[10000100];
int p[10000100], np;
int phi[10000100];
int mnp[10000100];
int mnps[10000100];
long long ans;
long long ans1, ans2, ans3;
int sum[10000100];
void primes() {
  nop[1] = 1;
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!nop[i]) {
      phi[i] = i - 1;
      p[++np] = i;
      mnp[i] = i;
      mnps[np] = 1;
      if (i * 2 <= n) ans3++;
    }
    for (int j = 1; j <= np && i * p[j] <= n; j++) {
      nop[i * p[j]] = 1;
      mnp[i * p[j]] = p[j];
      mnps[j]++;
      if (p[j] * 2 <= n) ans3++;
      if (i % p[j] != 0)
        phi[i * p[j]] = phi[i] * (p[j] - 1);
      else {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
    }
  }
  for (int i = 1; i <= np; i++) sum[i] = sum[i - 1] + mnps[i];
}
int main() {
  rd(n);
  primes();
  ans3 = ans3 * (ans3 - 1) / 2 * 3;
  long long tmp, j;
  for (int i = 2; i <= n; i++) {
    tmp = n / mnp[i];
    j = lower_bound(p + 1, p + np + 1, tmp) - p;
    if (mnp[i] * p[j] > n) j--;
    ans2 += sum[j];
    if (mnp[i] <= p[j]) ans2 -= 1;
    ans1 += i - 1 - phi[i];
  }
  ans2 /= 2;
  ans = ans3 - ans2 - ans1;
  printf("%I64d\n", ans);
  return 0;
}

```