#include <bits/stdc++.h>
using namespace std;
bool prime[10000005];
int last_prime[10000005];
int miu[10000005];
int sums[10000005];
int tot[10000005];
int main() {
  int n;
  scanf("%d", &n);
  int i;
  prime[1] = false;
  memset(prime, true, sizeof(prime));
  for (i = 2; i <= 10000000; i++) {
    int j;
    if (prime[i]) {
      last_prime[i] = i;
      if (i > 10000) continue;
      for (j = i * i; j <= 10000000; j += i) {
        prime[j] = false;
        if (last_prime[j] == 0) last_prime[j] = i;
      }
    }
  }
  miu[1] = 1;
  for (i = 2; i <= 10000000; i++) {
    if ((i / last_prime[i]) % last_prime[i] == 0) {
      miu[i] = 0;
    } else {
      miu[i] = -miu[i / last_prime[i]];
    }
  }
  long long ans = 0;
  for (i = 2; i <= n; i++) {
    if (miu[i] == 0) continue;
    long long sum = 0;
    int t = n / i;
    if (prime[i]) {
      sum = sum + ((long long)(t - 1) * (t - 2)) / 2;
    } else {
      sum = sum + ((long long)(t - 1) * t) / 2;
    }
    ans += miu[i] * sum;
  }
  int cnt = 0;
  for (i = 2; i <= n; i++) {
    if (prime[i]) continue;
    cnt++;
    tot[last_prime[i]]++;
  }
  for (i = 2; i < n; i++) {
    tot[i + 1] += tot[i];
  }
  ans += (long long)cnt * (cnt - 1);
  int cnt2 = 0;
  for (i = 2; i <= n / 2; i++) {
    sums[i] = sums[i - 1];
    if (prime[i]) {
      cnt2++;
      sums[i]++;
    }
  }
  for (i = 2; i <= n / 2; i++) {
    if (prime[i]) {
      ans -= (n / i) - 1;
      ans -= tot[n / i];
      cnt2--;
      if (cnt2 < 0) cnt2 = 0;
      ans += cnt2 * 3;
      if (n / i >= i) ans -= (sums[n / i] - sums[i]);
      ans += cnt * 3;
    }
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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;
bool prime[10000005];
int last_prime[10000005];
int miu[10000005];
int sums[10000005];
int tot[10000005];
int main() {
  int n;
  scanf("%d", &n);
  int i;
  prime[1] = false;
  memset(prime, true, sizeof(prime));
  for (i = 2; i <= 10000000; i++) {
    int j;
    if (prime[i]) {
      last_prime[i] = i;
      if (i > 10000) continue;
      for (j = i * i; j <= 10000000; j += i) {
        prime[j] = false;
        if (last_prime[j] == 0) last_prime[j] = i;
      }
    }
  }
  miu[1] = 1;
  for (i = 2; i <= 10000000; i++) {
    if ((i / last_prime[i]) % last_prime[i] == 0) {
      miu[i] = 0;
    } else {
      miu[i] = -miu[i / last_prime[i]];
    }
  }
  long long ans = 0;
  for (i = 2; i <= n; i++) {
    if (miu[i] == 0) continue;
    long long sum = 0;
    int t = n / i;
    if (prime[i]) {
      sum = sum + ((long long)(t - 1) * (t - 2)) / 2;
    } else {
      sum = sum + ((long long)(t - 1) * t) / 2;
    }
    ans += miu[i] * sum;
  }
  int cnt = 0;
  for (i = 2; i <= n; i++) {
    if (prime[i]) continue;
    cnt++;
    tot[last_prime[i]]++;
  }
  for (i = 2; i < n; i++) {
    tot[i + 1] += tot[i];
  }
  ans += (long long)cnt * (cnt - 1);
  int cnt2 = 0;
  for (i = 2; i <= n / 2; i++) {
    sums[i] = sums[i - 1];
    if (prime[i]) {
      cnt2++;
      sums[i]++;
    }
  }
  for (i = 2; i <= n / 2; i++) {
    if (prime[i]) {
      ans -= (n / i) - 1;
      ans -= tot[n / i];
      cnt2--;
      if (cnt2 < 0) cnt2 = 0;
      ans += cnt2 * 3;
      if (n / i >= i) ans -= (sums[n / i] - sums[i]);
      ans += cnt * 3;
    }
  }
  cout << ans << endl;
  return 0;
}

```