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>
const int N = 10000050;
using namespace std;
inline int gi() {
  char ch = getchar();
  int x = 0, q = 0;
  while (ch < '0' || ch > '9') ch == '-' ? q = 1 : 0, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return q ? (-x) : x;
}
int n, mu[N], mark[N], pri[N], phi[N], tot, low[N], t[N];
long long ans, sum;
inline void pre() {
  for (int i = 2, s; i <= n; ++i) {
    if (!mark[i]) pri[low[i] = ++tot] = i, phi[i] = i - 1, mu[i] = -1;
    for (int j = 1; j <= tot && (s = pri[j] * i) <= n; ++j) {
      mark[s] = 1;
      if (i % pri[j] == 0) {
        phi[s] = phi[i] * pri[j], mu[s] = 0;
        low[s] = low[i];
        break;
      } else {
        low[s] = (low[i] < j ? low[i] : j), mu[s] = -mu[i];
        phi[s] = phi[i] * (pri[j] - 1);
      }
    }
  }
  return;
}
int main() {
  cin >> n;
  pre();
  int s = 0;
  for (int i = 2; i <= n; ++i) {
    if ((pri[low[i]] << 1) > n) ++s;
    ans += i - phi[i] - 1;
    ++t[low[i]];
  }
  ans += (1ll * (n - 1) * (n - 2) / 2 - ans - 1ll * s * (n - s - 1) -
          1ll * (s) * (s - 1) / 2) *
         3;
  for (int i = 2; i <= tot; ++i) t[i] += t[i - 1];
  for (int i = 1, j = tot; i <= n; ++i) {
    for (; j && 1ll * pri[j] * pri[i] > n; --j)
      ;
    sum += 1ll * t[j] * (t[i] - t[i - 1]);
  }
  for (int i = 2; i <= n; ++i)
    sum += (1ll * (n / i) * (n / i) - (pri[low[i]] == i && 1ll * i * i > n)) *
           mu[i];
  cout << ans - sum / 2;
  return 0;
}