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;
}
int n, p[10000000 + 5], pn, u[10000000 + 5], mu[10000000 + 5],
    phi[10000000 + 5], a[10000000 + 5], b[10000000 + 5];
long long ans, S, cnt;
bool cmp(int a, int b) { return u[a] < u[b]; }
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int main() {
  n = read();
  for (int i = 2; i <= n; ++i) {
    if (!u[i]) p[++pn] = u[i] = i, mu[i] = -1, phi[i] = i - 1;
    for (int j = 1; i * p[j] <= n; ++j) {
      u[i * p[j]] = p[j];
      if (i % p[j])
        mu[i * p[j]] = -mu[i], phi[i * p[j]] = phi[i] * (p[j] - 1);
      else {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
    }
    a[i] = i;
    ans += i - 1 - phi[i];
  }
  for (int i = 1; i <= pn; ++i)
    if (p[i] > n / 2) ++cnt;
  ans += 3 * (1LL * (n - 1) * (n - 2) / 2 - ans - cnt * (n - 1 - cnt) -
              cnt * (cnt - 1) / 2);
  sort(a + 2, a + n + 1, cmp);
  for (int i = 2; i <= n; ++i) b[a[i]] = i;
  for (int i = 2; i <= n; ++i) {
    int l = 2, r = n, mid, s = 0;
    while (l <= r)
      if (1LL * u[a[mid = l + r >> 1]] * u[i] > n)
        r = mid - 1;
      else
        s = mid - 1, l = mid + 1;
    S += s;
  }
  for (int i = 2; i <= n; ++i)
    S += (1LL * (n / i) * (n / i) - (1LL * i * i > n && u[i] == i)) * mu[i];
  printf("%I64d", ans - S / 2);
  return 0;
}