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>
int p[10000000 + 5], pn, u[10000000 + 5], mu[10000000 + 5], phi[10000000 + 5],
    cnt, s[10000000 + 5];
long long ans, S;
bool cmp(int a, int b) { return u[a] < u[b]; }
int main() {
  int n, i, j;
  scanf("%d", &n);
  for (i = 2; i <= n; ++i) {
    if (!u[i]) p[++pn] = u[i] = i, mu[i] = -1, phi[i] = i - 1;
    for (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;
      }
    }
    ++s[u[i]];
    ans += i - 1 - phi[i];
  }
  for (i = 1; i <= pn; ++i)
    if (p[i] > n / 2) ++cnt;
  ans += 3 * (1LL * (n - 1) * (n - 2) / 2 - ans - 1LL * cnt * (n - 1 - cnt) -
              1LL * cnt * (cnt - 1) / 2);
  for (i = 2; i <= n; ++i) s[i] += s[i - 1];
  for (i = 2; i <= n; ++i) S += 1LL * (s[i] - s[i - 1]) * s[n / i];
  for (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);
}