#include <bits/stdc++.h>
using namespace std;
const int N = 10000005;
const int inf = 1e9 + 7;
long long ans, a, b, c;
int ip[N], pr[2000005], pre[N], phi[N], pre2[N];
int n, tot;
inline long long Solve() {
  long long res = 0;
  for (int i = (n); i >= (1); i--) pre2[i] += pre2[i + 1];
  for (int i = (2); i <= (n / 2); i++)
    if (ip[i]) {
      int j = n / i + 1;
      if (j < i) res += pre2[j] - pre2[i];
    }
  return res;
}
int main() {
  scanf("%d", &n);
  if (n <= 3) {
    puts("0");
    return 0;
  }
  phi[1] = 1;
  for (int i = (2); i <= (n); i++) ip[i] = 1;
  for (int i = (2); i <= (n); i++) {
    if (ip[i]) {
      phi[i] = i - 1;
      pr[tot++] = i;
    }
    for (int j = 0; j < tot; j++) {
      if (1ll * pr[j] * i > (long long)n) break;
      ++pre[pr[j]];
      ip[i * pr[j]] = 0;
      if (i % pr[j] == 0) {
        phi[i * pr[j]] = phi[i] * pr[j];
        break;
      }
      phi[i * pr[j]] = phi[i] * phi[pr[j]];
    }
  }
  for (int i = (n); i >= (1); i--) pre[i] += pre[i + 1];
  for (int i = (2); i <= (n); i++) {
    if (ip[i] && i * 2 > n) continue;
    b++;
    a += i - phi[i] - 1;
    if (ip[i]) {
      pre2[i] = 1;
      c += pre[n / i + 1];
    }
  }
  printf("%lld\n", b * (b - 1) / 2ll * 2 + c + Solve() - a);
  return 0;
}

### Prompt

Generate 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;
const int N = 10000005;
const int inf = 1e9 + 7;
long long ans, a, b, c;
int ip[N], pr[2000005], pre[N], phi[N], pre2[N];
int n, tot;
inline long long Solve() {
  long long res = 0;
  for (int i = (n); i >= (1); i--) pre2[i] += pre2[i + 1];
  for (int i = (2); i <= (n / 2); i++)
    if (ip[i]) {
      int j = n / i + 1;
      if (j < i) res += pre2[j] - pre2[i];
    }
  return res;
}
int main() {
  scanf("%d", &n);
  if (n <= 3) {
    puts("0");
    return 0;
  }
  phi[1] = 1;
  for (int i = (2); i <= (n); i++) ip[i] = 1;
  for (int i = (2); i <= (n); i++) {
    if (ip[i]) {
      phi[i] = i - 1;
      pr[tot++] = i;
    }
    for (int j = 0; j < tot; j++) {
      if (1ll * pr[j] * i > (long long)n) break;
      ++pre[pr[j]];
      ip[i * pr[j]] = 0;
      if (i % pr[j] == 0) {
        phi[i * pr[j]] = phi[i] * pr[j];
        break;
      }
      phi[i * pr[j]] = phi[i] * phi[pr[j]];
    }
  }
  for (int i = (n); i >= (1); i--) pre[i] += pre[i + 1];
  for (int i = (2); i <= (n); i++) {
    if (ip[i] && i * 2 > n) continue;
    b++;
    a += i - phi[i] - 1;
    if (ip[i]) {
      pre2[i] = 1;
      c += pre[n / i + 1];
    }
  }
  printf("%lld\n", b * (b - 1) / 2ll * 2 + c + Solve() - a);
  return 0;
}

```