#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  int x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(int a) {
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
inline void writeln(int a) {
  if (a < 0) {
    a = -a;
    putchar('-');
  }
  write(a);
  puts("");
}
const int p = 10000005;
bool heshu[p];
int n, T, k, r, phi[p], ycl[p], que[p], m, miu[p], tong[p], sss[p], dq;
long long sum1, sum2, sum3, sum4;
int main() {
  for (int i = 2; i < p; i++) {
    if (!heshu[i]) {
      que[++r] = i;
      ycl[i] = i;
      phi[i] = i - 1;
      miu[i] = -1;
    }
    for (int j = 1; j <= r && i <= (p - 1) / que[j]; j++) {
      heshu[k = i * que[j]] = 1;
      ycl[k] = que[j];
      if (i % que[j] == 0) {
        phi[k] = phi[i] * que[j];
        miu[k] = 0;
        break;
      }
      phi[k] = phi[i] * (que[j] - 1);
      miu[k] = -miu[i];
    }
  }
  phi[1] = ycl[1] = 1;
  n = read();
  for (int i = 2; i <= n; i++) tong[ycl[i]]++;
  for (int i = 2; i <= n; i++) {
    sum1 += i - 1 - phi[i];
    sss[i] = sss[i - 1] + tong[i];
  }
  for (int i = n / 2 + 1; i <= n; i++) {
    sum4 += tong[i] * (dq + sss[n / 2]);
    dq += tong[i];
  }
  int j = n / 2 + 1;
  for (int i = 2; i * 2 <= n; i++) {
    while (j * i > n) j--;
    sum2 += (long long)tong[i] * sss[j];
  }
  for (int i = 2; i <= n; i++) {
    sum2 +=
        ((long long)(n / i) * (n / i) - ((long long)i * i > n && !heshu[i])) *
        miu[i];
  }
  sum2 /= 2;
  sum3 = (long long)(n - 2) * (n - 1) / 2 - sum1 - sum2 - sum4;
  cout << sum1 + sum2 * 2 + sum3 * 3 << endl;
}

### Prompt

Generate a Cpp solution 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;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  int x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(int a) {
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
inline void writeln(int a) {
  if (a < 0) {
    a = -a;
    putchar('-');
  }
  write(a);
  puts("");
}
const int p = 10000005;
bool heshu[p];
int n, T, k, r, phi[p], ycl[p], que[p], m, miu[p], tong[p], sss[p], dq;
long long sum1, sum2, sum3, sum4;
int main() {
  for (int i = 2; i < p; i++) {
    if (!heshu[i]) {
      que[++r] = i;
      ycl[i] = i;
      phi[i] = i - 1;
      miu[i] = -1;
    }
    for (int j = 1; j <= r && i <= (p - 1) / que[j]; j++) {
      heshu[k = i * que[j]] = 1;
      ycl[k] = que[j];
      if (i % que[j] == 0) {
        phi[k] = phi[i] * que[j];
        miu[k] = 0;
        break;
      }
      phi[k] = phi[i] * (que[j] - 1);
      miu[k] = -miu[i];
    }
  }
  phi[1] = ycl[1] = 1;
  n = read();
  for (int i = 2; i <= n; i++) tong[ycl[i]]++;
  for (int i = 2; i <= n; i++) {
    sum1 += i - 1 - phi[i];
    sss[i] = sss[i - 1] + tong[i];
  }
  for (int i = n / 2 + 1; i <= n; i++) {
    sum4 += tong[i] * (dq + sss[n / 2]);
    dq += tong[i];
  }
  int j = n / 2 + 1;
  for (int i = 2; i * 2 <= n; i++) {
    while (j * i > n) j--;
    sum2 += (long long)tong[i] * sss[j];
  }
  for (int i = 2; i <= n; i++) {
    sum2 +=
        ((long long)(n / i) * (n / i) - ((long long)i * i > n && !heshu[i])) *
        miu[i];
  }
  sum2 /= 2;
  sum3 = (long long)(n - 2) * (n - 1) / 2 - sum1 - sum2 - sum4;
  cout << sum1 + sum2 * 2 + sum3 * 3 << endl;
}

```