#include <bits/stdc++.h>
using namespace std;
constexpr int kN = int(1E7 + 10);
vector<long long int> prime;
int l[kN], mu[kN], s[kN];
long long int n;
void pre() {
  mu[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (l[i] == 0) {
      mu[i] = -1;
      prime.push_back(l[i] = i);
    }
    for (int j : prime) {
      if (i * j > n) break;
      l[i * j] = min(l[i], j);
      if (i % j == 0) {
        mu[i * j] = 0;
        break;
      } else
        mu[i * j] = -mu[i];
    }
  }
  for (int i = 2; i <= n; i++) s[l[i]]++;
  for (int i = 3; i <= n; i++) s[i] += s[i - 1];
  return;
}
int main() {
  long long int ans = 0, one = 0, two = 0, three = 0, zero = 0, cnt = 1;
  scanf("%lld", &n);
  pre();
  for (int k = 1; k <= n; k++) one += mu[k] * (n / k) * (n / k);
  one = n * (n - 1) / 2 - (one >> 1);
  for (long long int i : prime)
    if (i * i < n)
      continue;
    else if ((i << 1) > n)
      cnt++;
    else if (i > n / i)
      three += s[i - 1] - s[n / i];
  zero = (((n - 1) + (n - cnt)) * cnt) >> 1;
  two = n * (n - 1) / 2 - zero - one - three;
  ans = one + two * 2 + three * 3;
  printf("%lld\n", ans);
}

### Prompt

Please create a solution in Cpp 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;
constexpr int kN = int(1E7 + 10);
vector<long long int> prime;
int l[kN], mu[kN], s[kN];
long long int n;
void pre() {
  mu[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (l[i] == 0) {
      mu[i] = -1;
      prime.push_back(l[i] = i);
    }
    for (int j : prime) {
      if (i * j > n) break;
      l[i * j] = min(l[i], j);
      if (i % j == 0) {
        mu[i * j] = 0;
        break;
      } else
        mu[i * j] = -mu[i];
    }
  }
  for (int i = 2; i <= n; i++) s[l[i]]++;
  for (int i = 3; i <= n; i++) s[i] += s[i - 1];
  return;
}
int main() {
  long long int ans = 0, one = 0, two = 0, three = 0, zero = 0, cnt = 1;
  scanf("%lld", &n);
  pre();
  for (int k = 1; k <= n; k++) one += mu[k] * (n / k) * (n / k);
  one = n * (n - 1) / 2 - (one >> 1);
  for (long long int i : prime)
    if (i * i < n)
      continue;
    else if ((i << 1) > n)
      cnt++;
    else if (i > n / i)
      three += s[i - 1] - s[n / i];
  zero = (((n - 1) + (n - cnt)) * cnt) >> 1;
  two = n * (n - 1) / 2 - zero - one - three;
  ans = one + two * 2 + three * 3;
  printf("%lld\n", ans);
}

```