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.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, prin, dys;
int zx[10000005], pri[10000005], phi[10000005], miu[10000005], sm[10000005];
long long ans, sum;
inline int read() {
  int n = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    n = n * 10 + c - '0';
    c = getchar();
  }
  return n * f;
}
int main() {
  register int i, j;
  n = read();
  for (phi[1] = miu[1] = 1, i = 2; i <= n; ++i) {
    if (!zx[i]) pri[++prin] = i, zx[i] = prin, phi[i] = i - 1, miu[i] = -1;
    for (j = 1; i * pri[j] <= n; ++j) {
      zx[i * pri[j]] = j;
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = phi[i] * pri[j];
        miu[i * pri[j]] = 0;
        break;
      } else {
        phi[i * pri[j]] = phi[i] * (pri[j] - 1);
        miu[i * pri[j]] = -miu[i];
      }
    }
    ans += i - phi[i] - 1;
    ++sm[zx[i]];
  }
  for (i = 1; i <= prin; ++i)
    if (pri[i] * 2 > n) ++dys;
  ans += (1LL * (n - 1) * (n - 2) / 2 - ans - 1LL * dys * (n - dys - 1) -
          1LL * dys * (dys - 1) / 2) *
         3;
  for (i = 1; i <= prin; ++i) sm[i] += sm[i - 1];
  for (i = 1, j = prin; i <= prin; ++i) {
    for (; j && pri[i] * pri[j] > n; --j)
      ;
    sum += 1LL * sm[j] * (sm[i] - sm[i - 1]);
  }
  for (i = 2; i <= n; ++i)
    sum += (1LL * (n / i) * (n / i) - (pri[zx[i]] == i && 1LL * i * i > n)) *
           miu[i];
  printf("%I64d", ans - sum / 2);
}