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;
long long pri[10000028], phi[10000028], cnt[10000028], en = 0, n, res;
void init() {
  phi[1] = 1;
  for (long long i = 2; i <= n; ++i) {
    if (!pri[i]) pri[++en] = i, phi[i] = i - 1, ++cnt[en];
    for (long long j = 1; j <= en && pri[j] * i <= n; ++j) {
      pri[pri[j] * i] = 1, ++cnt[j];
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = pri[j] * phi[i];
        break;
      }
      phi[i * pri[j]] = phi[i] * (pri[j] - 1);
    }
  }
  for (long long i = 1; i < 10000028; ++i) phi[i] += phi[i - 1];
}
signed main() {
  cin >> n;
  init();
  res = n * (n - 1) / 2 - phi[n] + 1;
  long long t = 1, cn = 0, tt;
  for (; t <= en; ++t)
    if (pri[t] > n / 2) break;
  --t;
  for (tt = t; tt <= en; ++tt)
    if (pri[tt] > n) break;
  --tt;
  for (long long i = 1; i <= en; ++i) {
    long long pl =
        upper_bound(pri + 1, pri + en + 1, max(n / pri[i], pri[i])) - pri - 1;
    if (t > pl) res += (t - pl) * cnt[i] * 3;
    cn += (tt - pl) * cnt[i];
  }
  res += (phi[n] - n - cn) * 2;
  cout << res << endl;
}