#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18 + 5;
int mod = (int)1e9 + 7;
const int logN = 18;
const int inf = 1e9 + 9;
const int N = 1e7 + 6;
int n, bef[N], dp[N], pre[N];
int main() {
  scanf("%d", &n);
  long long A = 0, B = 0, C = 0;
  for (int i = n; i >= 2; i--) {
    for (int j = i + i; j <= n; j += i) {
      bef[j] = i;
    }
  }
  for (int i = 2; i <= n; i++)
    if (!bef[i]) bef[i] = i;
  for (int i = 2; i <= n; i++) {
    double res = i;
    int x = i;
    while (x > 1) {
      int t = bef[x];
      while (x % t == 0) x /= t;
      res = res * (1 - 1.0 / t);
    }
    dp[i] = i - (int)(res + 0.0000001) - 1;
    A += dp[i];
  }
  for (int i = 2; i <= n; i++) {
    if (bef[i] * 2 <= n) C++;
    pre[bef[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    pre[i] += pre[i - 1];
  }
  for (int i = 2; i <= n; i++) {
    B += pre[n / bef[i]] - (bef[i] * (long long)bef[i] <= n);
  }
  B /= 2;
  C = C * (long long)(C - 1) / 2;
  cout << C + C + C - B - A << '\n';
  return 0;
}

### Prompt

Construct a cpp code solution to the problem outlined:

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 long long linf = 1e18 + 5;
int mod = (int)1e9 + 7;
const int logN = 18;
const int inf = 1e9 + 9;
const int N = 1e7 + 6;
int n, bef[N], dp[N], pre[N];
int main() {
  scanf("%d", &n);
  long long A = 0, B = 0, C = 0;
  for (int i = n; i >= 2; i--) {
    for (int j = i + i; j <= n; j += i) {
      bef[j] = i;
    }
  }
  for (int i = 2; i <= n; i++)
    if (!bef[i]) bef[i] = i;
  for (int i = 2; i <= n; i++) {
    double res = i;
    int x = i;
    while (x > 1) {
      int t = bef[x];
      while (x % t == 0) x /= t;
      res = res * (1 - 1.0 / t);
    }
    dp[i] = i - (int)(res + 0.0000001) - 1;
    A += dp[i];
  }
  for (int i = 2; i <= n; i++) {
    if (bef[i] * 2 <= n) C++;
    pre[bef[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    pre[i] += pre[i - 1];
  }
  for (int i = 2; i <= n; i++) {
    B += pre[n / bef[i]] - (bef[i] * (long long)bef[i] <= n);
  }
  B /= 2;
  C = C * (long long)(C - 1) / 2;
  cout << C + C + C - B - A << '\n';
  return 0;
}

```