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_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> prod(n + 1, 1), par(n + 1), ta(n + 1);
  long long e = n - 1;
  for (int i = 2; i <= n; i++) {
    if (par[i]) continue;
    if (i * 2 > n) e--;
    for (int j = 1; j * i <= n; j++) {
      if (par[i * j] == 0 && i <= n / 2) ta[i]++;
      prod[i * j] *= i;
      par[i * j]++;
    }
  }
  e = e * (e - 1) / 2;
  long long res = 0;
  for (int i = 2; i <= n; i++) {
    if (prod[i] != i) continue;
    long long co = n / i;
    long long v = co * (co - 1) / 2;
    if (par[i] & 1)
      res += v;
    else
      res -= v;
  }
  e -= res;
  long long v = 0;
  int ind = n;
  long long te = 0;
  for (int i = 2; i <= n / 2; i++) {
    if (ta[i] == 0) continue;
    while (ind > (n / i)) {
      te += ta[ind];
      ind--;
    }
    long long le = ta[i], ri = te;
    if (i > (n / i)) ri -= le;
    v += le * ri;
  }
  v /= 2;
  e -= v;
  res += v * 3;
  res += e * 2;
  cout << res << "\n";
  return 0;
}