#include <bits/stdc++.h>
using namespace std;
bool isp[11111111];
long long p1[11111111], p2[11111111];
long long phi[11111111];
int plist[11111111 / 10];
int pcnt;
long long ans, ans1, ans2, ans3;
int n;
int main() {
  cin >> n;
  memset(isp, 1, sizeof(isp));
  isp[0] = isp[1] = 0;
  phi[0] = 0;
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (isp[i]) {
      plist[++pcnt] = i;
      phi[i] = i - 1;
    }
    for (int j = 1; j <= pcnt; j++) {
      if (1ll * i * plist[j] > n) break;
      int tmp = i * plist[j];
      p1[plist[j]]++;
      isp[tmp] = 0;
      if (i % plist[j] != 0) {
        phi[tmp] = phi[i] * (plist[j] - 1);
      } else {
        phi[tmp] = phi[i] * plist[j];
        break;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) p1[i] += p1[i + 1];
  long long ans1 = 0, ans2 = 0, ans3 = 0;
  for (int i = 2; i <= n; i++) {
    if (isp[i] && i * 2 > n) continue;
    ans2++;
    ans1 += i - phi[i] - 1;
    if (isp[i]) {
      p2[i] = 1;
      ans3 += p1[n / i + 1];
    }
  }
  for (int i = n - 1; i >= 2; i--) p2[i] += p2[i + 1];
  for (int i = 2; i * 2 <= n; i++)
    if (isp[i] && n / i + 1 < i) ans3 += p2[n / i + 1] - p2[i];
  ans = 1ll * ans2 * (ans2 - 1) - ans1 + ans3;
  cout << ans << endl;
  return 0;
}

### 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;
bool isp[11111111];
long long p1[11111111], p2[11111111];
long long phi[11111111];
int plist[11111111 / 10];
int pcnt;
long long ans, ans1, ans2, ans3;
int n;
int main() {
  cin >> n;
  memset(isp, 1, sizeof(isp));
  isp[0] = isp[1] = 0;
  phi[0] = 0;
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (isp[i]) {
      plist[++pcnt] = i;
      phi[i] = i - 1;
    }
    for (int j = 1; j <= pcnt; j++) {
      if (1ll * i * plist[j] > n) break;
      int tmp = i * plist[j];
      p1[plist[j]]++;
      isp[tmp] = 0;
      if (i % plist[j] != 0) {
        phi[tmp] = phi[i] * (plist[j] - 1);
      } else {
        phi[tmp] = phi[i] * plist[j];
        break;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) p1[i] += p1[i + 1];
  long long ans1 = 0, ans2 = 0, ans3 = 0;
  for (int i = 2; i <= n; i++) {
    if (isp[i] && i * 2 > n) continue;
    ans2++;
    ans1 += i - phi[i] - 1;
    if (isp[i]) {
      p2[i] = 1;
      ans3 += p1[n / i + 1];
    }
  }
  for (int i = n - 1; i >= 2; i--) p2[i] += p2[i + 1];
  for (int i = 2; i * 2 <= n; i++)
    if (isp[i] && n / i + 1 < i) ans3 += p2[n / i + 1] - p2[i];
  ans = 1ll * ans2 * (ans2 - 1) - ans1 + ans3;
  cout << ans << endl;
  return 0;
}

```