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 main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> lp(n + 1, 0), pflp(n + 1, 0);
  vector<int> e(n + 1, 1), u(n + 1, 0), bad(n + 1, 0);
  for (int i = 1; i <= n; i++) e[i] = i;
  for (int i = 2; i <= n; i++) {
    if (lp[i]) continue;
    for (int j = i; j <= n; j += i) {
      if (!lp[j]) lp[j] = i;
      e[j] /= i;
      e[j] *= i - 1;
    }
  }
  for (int i = 1; i <= n; i++)
    if (i == 1 || (i == lp[i] && i * 2 > n)) bad[i] = 1;
  long long bad_cnt = count(bad.begin(), bad.end(), 1);
  for (int i = 1; i <= n; i++)
    if (!bad[i]) pflp[lp[i]]++;
  for (int i = 1; i <= n; i++) pflp[i] += pflp[i - 1];
  for (int i = 2; i <= n; i++) {
    if (lp[i] == i) u[i] = 1;
    if (lp[i] == lp[i / lp[i]])
      u[i] = u[i / lp[i]];
    else
      u[i] = u[i / lp[i]] + 1;
  }
  long long n1 = 0, n2 = 0, n3 = 0, n4 = 0;
  for (int i = 2; i <= n; i++) {
    if (bad[i]) continue;
    n1 += i - e[i] - 1;
  }
  long long primes = 1;
  for (int i = 2; i <= n; i++) {
    if (lp[i] == i)
      primes++;
    else {
      n2 += e[i];
      n2 -= primes;
      n2 += u[i];
    }
  }
  for (int i = 2; i <= n; i++) {
    if (i > n / 2) break;
    if (lp[i] == i) {
      n2 += pflp[n / i];
      for (int j = i; j <= n; j += i)
        if (lp[j] <= n / i) n2--;
    }
  }
  for (int i = 2; i <= n; i++) {
    long long p = lp[i], q = i / lp[i];
    if (q == lp[q] && q != 1 && q != p) n2--;
  }
  n4 = bad_cnt * 1ll * (n - bad_cnt) + (bad_cnt * (bad_cnt - 1)) / 2ll;
  n3 = (n * (n - 1ll)) / 2ll - n1 - n2 - n4;
  cout << n1 + n2 * 2ll + n3 * 3ll << "\n";
  return 0;
}