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;
const int N = (int)1e7 + 6;
int n;
int lp[N];
int cnt[N];
int phi[N];
int pref[N];
int border = N - 1;
vector<int> primes;
int smallsum = 0;
void solve() {
  phi[1] = 1;
  for (int i = 2; i < N; i++) {
    pref[i] = pref[i - 1];
    if (!lp[i]) {
      lp[i] = i;
      phi[i] = i - 1;
      primes.push_back(i);
      ++pref[i];
    }
    for (size_t j = 0; j < primes.size() && i * primes[j] < N; j++) {
      if (primes[j] <= lp[i]) lp[i * primes[j]] = primes[j];
      phi[i * primes[j]] =
          0 == i % primes[j] ? phi[i] * primes[j] : phi[i] * (primes[j] - 1);
    }
  }
  cin >> n;
  long long ans = 0;
  int bnd = n / 2 + 1;
  for (int i = 2; i <= n; i++) {
    while (border > n / i) {
      smallsum -= cnt[border--];
    }
    ans += i - 1 - phi[i];
    if (lp[i] * 1ll * lp[i] <= n) {
      int too_big = i >= bnd ? pref[i] - pref[bnd - 1] : 0;
      int l = n / lp[i];
      int r = min(i - 1, bnd - 1);
      int just_big = r >= l ? pref[r] - pref[l] : 0;
      int cop = phi[i] - 1;
      ans += (cop - too_big - just_big) * 2 + just_big * 3;
    } else {
      if (2 * i > n) continue;
      int cop = phi[i] - 1;
      ans += 2 * cop + (cop - smallsum);
    }
    ++cnt[lp[i]];
    if (lp[i] <= border) ++smallsum;
  }
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int T = 1;
  while (T--) solve();
  return 0;
}