#include <bits/stdc++.h>
using namespace std;
const int nax = 1e7 + 10;
int isprime[nax], phi[nax], fac[nax];
int erlkgjerlgj[nax];
void add(int i, int v) {
  for (i++; i < nax; i += i & -i) erlkgjerlgj[i] += v;
}
int sum(int i) {
  int r = 0;
  for (i++; i; i -= i & -i) r += erlkgjerlgj[i];
  return r;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  fill_n(isprime + 2, nax - 2, 1);
  for (int i = 0; i < nax; i++) phi[i] = i;
  for (int i = 2; i < nax; i++) {
    if (!isprime[i]) continue;
    for (int j = i * 2; j < nax; j += i) {
      isprime[j] = 0;
    }
    for (int j = i; j < nax; j += i) {
      phi[j] = phi[j] / i * (i - 1);
      if (!fac[j]) fac[j] = i;
    }
  }
  long long zeros = 1;
  for (int i = 2; i <= n; i++) {
    if (isprime[i] && i * 2 > n) zeros++;
  }
  zeros = n * (n - 1) / 2 - (n - zeros) * (n - zeros - 1) / 2;
  long long ones = 0;
  for (int i = 2; i <= n; i++) {
    ones += i - 1 - phi[i];
  }
  long long twos = -ones;
  for (int i = 2; i <= n; i++) {
    twos += sum(n / fac[i]);
    if (!isprime[i]) {
    }
    add(fac[i], 1);
  }
  long long threes = (long long)n * (n - 1) / 2 - zeros - ones - twos;
  cout << ones + 2 * twos + 3 * threes << endl;
}

### Prompt

Please provide a Cpp coded solution 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;
const int nax = 1e7 + 10;
int isprime[nax], phi[nax], fac[nax];
int erlkgjerlgj[nax];
void add(int i, int v) {
  for (i++; i < nax; i += i & -i) erlkgjerlgj[i] += v;
}
int sum(int i) {
  int r = 0;
  for (i++; i; i -= i & -i) r += erlkgjerlgj[i];
  return r;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  fill_n(isprime + 2, nax - 2, 1);
  for (int i = 0; i < nax; i++) phi[i] = i;
  for (int i = 2; i < nax; i++) {
    if (!isprime[i]) continue;
    for (int j = i * 2; j < nax; j += i) {
      isprime[j] = 0;
    }
    for (int j = i; j < nax; j += i) {
      phi[j] = phi[j] / i * (i - 1);
      if (!fac[j]) fac[j] = i;
    }
  }
  long long zeros = 1;
  for (int i = 2; i <= n; i++) {
    if (isprime[i] && i * 2 > n) zeros++;
  }
  zeros = n * (n - 1) / 2 - (n - zeros) * (n - zeros - 1) / 2;
  long long ones = 0;
  for (int i = 2; i <= n; i++) {
    ones += i - 1 - phi[i];
  }
  long long twos = -ones;
  for (int i = 2; i <= n; i++) {
    twos += sum(n / fac[i]);
    if (!isprime[i]) {
    }
    add(fac[i], 1);
  }
  long long threes = (long long)n * (n - 1) / 2 - zeros - ones - twos;
  cout << ones + 2 * twos + 3 * threes << endl;
}

```