#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, mu[10001000];
long long prime[1000010], tot;
bool vis[10001000];
long long Min[10001000];
long long a[10001000];
inline void init() {
  mu[1] = 1;
  for (long long i = (2); i <= (n); i++) {
    if (!vis[i]) {
      prime[++tot] = i;
      mu[i] = -1;
    }
    for (long long j = (1); j <= (tot); j++) {
      if (i * prime[j] > n) break;
      vis[i * prime[j]] = 1;
      if (i % prime[j] == 0) {
        mu[i * prime[j]] = 0;
        break;
      }
      mu[i * prime[j]] = -mu[i];
    }
  }
  for (long long i = (1); i <= (n); i++) mu[i] += mu[i - 1];
}
inline long long calc_step_1() {
  long long last;
  long long res = 0;
  for (long long i = 1; i <= n; i = last + 1) {
    last = n / (n / i);
    res += 1ll * (n / i) * (n / i) * (mu[last] - mu[i - 1]);
  }
  return (1ll * n * (n - 1) - res + 1) / 2;
}
inline long long calc_step_2() {
  memset(vis, 0, sizeof(vis));
  a[1] = 1;
  for (long long i = (1); i <= (tot); i++) {
    long long k = prime[i];
    for (long long j = k; j <= n; j += k) {
      if (!vis[j]) {
        a[j] = k;
        vis[j] = 1;
      }
    }
  }
  for (long long i = (1); i <= (n); i++) Min[a[i]]++;
  long long res = 0;
  for (long long i = (1); i <= (tot); i++) {
    for (long long j = (1); j <= (tot); j++) {
      if (prime[i] * prime[j] > n) break;
      res += Min[prime[i]] * Min[prime[j]];
    }
  }
  for (long long i = (1); i <= (tot); i++)
    if (prime[i] * prime[i] <= n) res -= Min[prime[i]];
  return res;
}
inline long long calc_step_3() {
  long long res = 0;
  long long sum = 0;
  for (long long i = (1); i <= (tot); i++) {
    if (2 * prime[i] > n) break;
    long long Max = prime[i];
    res += Min[Max] * sum;
    res += Min[Max] * sum;
    res += Min[Max] * (Min[Max] - 1);
    sum += Min[prime[i]];
  }
  return res;
}
int main() {
  n = read();
  init();
  long long A = calc_step_1();
  long long B = calc_step_2();
  long long C = calc_step_3();
  B = (B / 2 - A);
  C = (C / 2 - A - B);
  cout << A + 2 * B + 3 * C;
  return 0;
}

### Prompt

Your task is to create 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 long long read() {
  char ch = getchar();
  long long x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, mu[10001000];
long long prime[1000010], tot;
bool vis[10001000];
long long Min[10001000];
long long a[10001000];
inline void init() {
  mu[1] = 1;
  for (long long i = (2); i <= (n); i++) {
    if (!vis[i]) {
      prime[++tot] = i;
      mu[i] = -1;
    }
    for (long long j = (1); j <= (tot); j++) {
      if (i * prime[j] > n) break;
      vis[i * prime[j]] = 1;
      if (i % prime[j] == 0) {
        mu[i * prime[j]] = 0;
        break;
      }
      mu[i * prime[j]] = -mu[i];
    }
  }
  for (long long i = (1); i <= (n); i++) mu[i] += mu[i - 1];
}
inline long long calc_step_1() {
  long long last;
  long long res = 0;
  for (long long i = 1; i <= n; i = last + 1) {
    last = n / (n / i);
    res += 1ll * (n / i) * (n / i) * (mu[last] - mu[i - 1]);
  }
  return (1ll * n * (n - 1) - res + 1) / 2;
}
inline long long calc_step_2() {
  memset(vis, 0, sizeof(vis));
  a[1] = 1;
  for (long long i = (1); i <= (tot); i++) {
    long long k = prime[i];
    for (long long j = k; j <= n; j += k) {
      if (!vis[j]) {
        a[j] = k;
        vis[j] = 1;
      }
    }
  }
  for (long long i = (1); i <= (n); i++) Min[a[i]]++;
  long long res = 0;
  for (long long i = (1); i <= (tot); i++) {
    for (long long j = (1); j <= (tot); j++) {
      if (prime[i] * prime[j] > n) break;
      res += Min[prime[i]] * Min[prime[j]];
    }
  }
  for (long long i = (1); i <= (tot); i++)
    if (prime[i] * prime[i] <= n) res -= Min[prime[i]];
  return res;
}
inline long long calc_step_3() {
  long long res = 0;
  long long sum = 0;
  for (long long i = (1); i <= (tot); i++) {
    if (2 * prime[i] > n) break;
    long long Max = prime[i];
    res += Min[Max] * sum;
    res += Min[Max] * sum;
    res += Min[Max] * (Min[Max] - 1);
    sum += Min[prime[i]];
  }
  return res;
}
int main() {
  n = read();
  init();
  long long A = calc_step_1();
  long long B = calc_step_2();
  long long C = calc_step_3();
  B = (B / 2 - A);
  C = (C / 2 - A - B);
  cout << A + 2 * B + 3 * C;
  return 0;
}

```