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 M = 10000005;
int n;
int eu[M];
bool pr[M];
int u[M] = {};
int main() {
  for (int i = 0; i < (int)(M); ++i) pr[i] = true;
  pr[0] = pr[1] = false;
  for (int i = 0; i < (int)(10000); ++i)
    if (pr[i]) {
      for (int j = i * i; j < M; j += i) {
        pr[j] = false;
      }
    }
  for (int i = 0; i < (int)(M); ++i) eu[i] = 1;
  eu[1] = 0;
  for (int i = 0; i < (int)(M); ++i)
    if (pr[i]) {
      for (long long x = i; x < M; x *= i) {
        if (x == i) {
          for (int y = x; y < M; y += x) {
            eu[y] *= i - 1;
          }
        } else {
          for (int y = x; y < M; y += x) {
            eu[y] *= i;
          }
        }
      }
    }
  int n;
  cin >> n;
  if (n < 4) {
    cout << 0 << endl;
    return 0;
  }
  int mx = n / 2;
  int cnt = 0;
  for (int i = mx + 1; i <= n; ++i) {
    cnt += pr[i];
  }
  long long ans = (long long)(n - 1) * (n - 2) / 2;
  ans -= (long long)cnt * (cnt - 1) / 2;
  ans -= (long long)cnt * (n - 1 - cnt);
  int bad = 1;
  for (int i = 2; i <= n; ++i) {
    if (i > mx && pr[i]) {
      ++bad;
      continue;
    }
    ans += eu[i] - bad;
  }
  int z = sqrt(n + 0.5) + 1;
  cnt = 0;
  int j = 2;
  for (int i = z; i <= n; ++i)
    if (pr[i]) u[i] = 1;
  for (int i = mx + 1; i <= n; ++i)
    if (pr[i]) u[i] = 1;
  int tmp = 0;
  for (int i = 2; i <= n; ++i)
    if (!u[i]) {
      ++tmp;
    }
  for (int i = mx; i >= z; --i)
    if (pr[i]) {
      ++cnt;
      while ((long long)j * i <= n) {
        if (pr[j])
          for (int k = j; k <= n; k += j) {
            if (!u[k]) {
              u[k] = 1;
              --tmp;
            }
          }
        ++j;
      }
      ans += tmp;
    }
  ans += (long long)cnt * (cnt - 1) / 2;
  cout << ans << endl;
  return 0;
}