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;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
bool b[10000000 + 5];
int n, s[10000000 / 5], num = 0, mn[10000000 + 5], mu[10000000 + 5], size,
                        N[10000000 + 5];
long long ans = 0, res = 0, res2 = 0, res3 = 0, num3 = 0;
int main() {
  n = read();
  mu[1] = 1;
  size = sqrt(n);
  for (int i = 2; i <= n; ++i) {
    if (!b[i]) {
      s[++num] = i, mu[i] = -1, mn[i] = i;
      if (i > n >> 1) ++num3;
    }
    for (int j = 1; s[j] * i <= n; ++j) {
      b[s[j] * i] = 1;
      mn[s[j] * i] = min(mn[i], s[j]);
      if (i % s[j] == 0) break;
      mu[s[j] * i] = -mu[i];
    }
    mu[i] += mu[i - 1];
    ++N[mn[i]];
  }
  for (int i = 1, last; i <= n; i = last + 1) {
    last = n / (n / i);
    res += 1LL * (mu[last] - mu[i - 1]) * (n / i) * (n / i);
  }
  ans += (1LL * n * n - (res + n - 1)) / 2;
  res = (res - 2 * n + 1) / 2;
  for (int i = 1; i <= n; ++i) N[i] += N[i - 1];
  for (int i = 1; i <= size; ++i)
    res2 += 1LL * (N[i] - N[i - 1]) * (N[n / i] - N[i]) +
            1LL * (N[i] - N[i - 1]) * (N[i] - N[i - 1] - 1) / 2;
  for (int i = 2; i <= n; ++i) {
    int num1 = 0, num2 = 0;
    for (int j = i; j <= n; j += i)
      if (j > 1)
        if (mn[j] <= size)
          ++num1;
        else
          ++num2;
    res2 +=
        (mu[i] - mu[i - 1]) * (1LL * num1 * (num1 - 1) / 2 + 1LL * num2 * num1);
  }
  ans += res2 * 2;
  res3 = res - res2;
  res3 -= 1LL * num3 * (num3 - 1) / 2 + 1LL * num3 * (n - 1 - num3);
  ans += res3 * 3;
  cout << ans;
  return 0;
}