#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
using namespace std;
const int MX = (int)1e7 + 100;
int n;
int bb[MX];
int phi[MX];
int cnt[MX];
vector<int> primes;
int cp[MX];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  phi[1] = 1;
  for (int i = 1; i <= n; ++i) bb[i] = i;
  long long ans = 0;
  for (int i = 2; i <= n; ++i) {
    int now = i / bb[i];
    phi[i] = bb[i] - 1;
    while (now % bb[i] == 0) now /= bb[i], phi[i] *= bb[i];
    phi[i] *= phi[now];
    cnt[i] = 1 + cnt[now];
    cp[i] = cp[i - 1];
    if (i == bb[i]) primes.push_back(i), ++cp[i];
    for (int x : primes) {
      if (x > bb[i] || x * i > n) break;
      bb[i * x] = x;
    }
    ans += i - 1 - phi[i];
    int lf = phi[i] - 1;
    if (i != bb[i]) {
      ans += 2 * (lf - primes.size() + cnt[i]);
    }
  }
  while (!primes.empty() && primes.back() * 2 > n) primes.pop_back();
  for (int i = 2; i <= n; ++i) {
    if (i != bb[i]) {
      int x = cp[n / bb[i]] - cnt[i];
      ans += 2 * x;
      int y = primes.size() - x - cnt[i];
      ans += 3 * y;
    }
  }
  for (int i = 0; i < primes.size(); ++i) {
    int x = cp[min(primes[i] - 1, n / primes[i])];
    ans += 2 * x;
    ans += 3 * (i - x);
  }
  cout << ans << "\n";
  return 0;
}

### Prompt

Your challenge is to write a CPP solution to the following 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.

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
using namespace std;
const int MX = (int)1e7 + 100;
int n;
int bb[MX];
int phi[MX];
int cnt[MX];
vector<int> primes;
int cp[MX];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  phi[1] = 1;
  for (int i = 1; i <= n; ++i) bb[i] = i;
  long long ans = 0;
  for (int i = 2; i <= n; ++i) {
    int now = i / bb[i];
    phi[i] = bb[i] - 1;
    while (now % bb[i] == 0) now /= bb[i], phi[i] *= bb[i];
    phi[i] *= phi[now];
    cnt[i] = 1 + cnt[now];
    cp[i] = cp[i - 1];
    if (i == bb[i]) primes.push_back(i), ++cp[i];
    for (int x : primes) {
      if (x > bb[i] || x * i > n) break;
      bb[i * x] = x;
    }
    ans += i - 1 - phi[i];
    int lf = phi[i] - 1;
    if (i != bb[i]) {
      ans += 2 * (lf - primes.size() + cnt[i]);
    }
  }
  while (!primes.empty() && primes.back() * 2 > n) primes.pop_back();
  for (int i = 2; i <= n; ++i) {
    if (i != bb[i]) {
      int x = cp[n / bb[i]] - cnt[i];
      ans += 2 * x;
      int y = primes.size() - x - cnt[i];
      ans += 3 * y;
    }
  }
  for (int i = 0; i < primes.size(); ++i) {
    int x = cp[min(primes[i] - 1, n / primes[i])];
    ans += 2 * x;
    ans += 3 * (i - x);
  }
  cout << ans << "\n";
  return 0;
}

```