#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chkmin(T& x, U y) {
  if (y < x) x = y;
}
const int MAXN = 1e7 + 10;
int p[MAXN], phi[MAXN], cnt[MAXN], prm[MAXN], prn;
int main() {
  int n;
  scanf("%d", &n);
  long long ans = 0;
  for (int i = 2; i <= n; i++) {
    if (!p[i]) {
      p[i] = i;
      phi[i] = i - 1;
      prm[prn++] = i;
    }
    int k = min(n / i, p[i]);
    for (int j = 0; j < prn && prm[j] <= k; j++) {
      p[prm[j] * i] = prm[j];
      phi[prm[j] * i] = phi[i] * (prm[j] - (prm[j] < p[i]));
    }
    ans -= 2 * (i - 1 - phi[i]);
  }
  for (int i = 2; i <= n; i++) cnt[p[i]]++;
  for (int i = 2; i <= n; i++) cnt[i] += cnt[i - 1];
  int tot = n - 1;
  for (int i = 2; i <= n; i++)
    if (p[i] * 2 > n) tot--;
  for (int i = 2; i <= n; i++) {
    if (p[i] * 2 > n) continue;
    ans += 3 * (tot - 1) - (cnt[n / p[i]] - (1LL * p[i] * p[i] <= n));
  }
  cout << ans / 2 << endl;
  return 0;
}

### Prompt

Develop a solution in Cpp 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;
template <typename T, typename U>
inline void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chkmin(T& x, U y) {
  if (y < x) x = y;
}
const int MAXN = 1e7 + 10;
int p[MAXN], phi[MAXN], cnt[MAXN], prm[MAXN], prn;
int main() {
  int n;
  scanf("%d", &n);
  long long ans = 0;
  for (int i = 2; i <= n; i++) {
    if (!p[i]) {
      p[i] = i;
      phi[i] = i - 1;
      prm[prn++] = i;
    }
    int k = min(n / i, p[i]);
    for (int j = 0; j < prn && prm[j] <= k; j++) {
      p[prm[j] * i] = prm[j];
      phi[prm[j] * i] = phi[i] * (prm[j] - (prm[j] < p[i]));
    }
    ans -= 2 * (i - 1 - phi[i]);
  }
  for (int i = 2; i <= n; i++) cnt[p[i]]++;
  for (int i = 2; i <= n; i++) cnt[i] += cnt[i - 1];
  int tot = n - 1;
  for (int i = 2; i <= n; i++)
    if (p[i] * 2 > n) tot--;
  for (int i = 2; i <= n; i++) {
    if (p[i] * 2 > n) continue;
    ans += 3 * (tot - 1) - (cnt[n / p[i]] - (1LL * p[i] * p[i] <= n));
  }
  cout << ans / 2 << endl;
  return 0;
}

```