#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 10;
int fac[N];
long long phi[N];
void gen_primes() {
  iota(fac, fac + N, 0);
  phi[1] = 1;
  for (int i = 2; i < N; i++) {
    if (fac[i] == i) {
      for (int j = 2 * i; j < N; j += i) {
        if (fac[j] == j) fac[j] = i;
      }
    }
    long long f = fac[i];
    while (i % f == 0) f *= fac[i];
    f /= fac[i];
    phi[i] = phi[i / f] * (f - f / fac[i]);
  }
}
int BIT[N];
void update(int i) {
  for (i = N - 1 - i; i < N; i += i & -i) BIT[i]++;
}
int query(int i) {
  int res = 0;
  for (i = N - 1 - i; i > 0; i -= i & -i) res += BIT[i];
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  gen_primes();
  int n;
  cin >> n;
  long long ans = 0;
  for (int v = 3, sub = 0; v <= n; v++) {
    if (fac[v] == v && 2 * v > n) {
      sub += 2;
      continue;
    }
    ans += v - 3 + phi[v] + query(1 + n / fac[v]) - sub;
    update(fac[v]);
  }
  cout << ans << '\n';
  return 0;
}

### Prompt

Create a solution in Cpp for 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>
using namespace std;
const int N = 1e7 + 10;
int fac[N];
long long phi[N];
void gen_primes() {
  iota(fac, fac + N, 0);
  phi[1] = 1;
  for (int i = 2; i < N; i++) {
    if (fac[i] == i) {
      for (int j = 2 * i; j < N; j += i) {
        if (fac[j] == j) fac[j] = i;
      }
    }
    long long f = fac[i];
    while (i % f == 0) f *= fac[i];
    f /= fac[i];
    phi[i] = phi[i / f] * (f - f / fac[i]);
  }
}
int BIT[N];
void update(int i) {
  for (i = N - 1 - i; i < N; i += i & -i) BIT[i]++;
}
int query(int i) {
  int res = 0;
  for (i = N - 1 - i; i > 0; i -= i & -i) res += BIT[i];
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  gen_primes();
  int n;
  cin >> n;
  long long ans = 0;
  for (int v = 3, sub = 0; v <= n; v++) {
    if (fac[v] == v && 2 * v > n) {
      sub += 2;
      continue;
    }
    ans += v - 3 + phi[v] + query(1 + n / fac[v]) - sub;
    update(fac[v]);
  }
  cout << ans << '\n';
  return 0;
}

```