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>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 20;
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-9;
bool pchk[10000050];
int val[10000050];
int mn[10000050];
long long sum[10000050];
int main() {
  int N, i, j;
  scanf("%d", &N);
  if (N <= 2) return !printf("0\n");
  for (i = 1; i <= N; i++) val[i] = 1;
  int c1 = 0;
  for (i = 2; i <= N; i++) {
    if (pchk[i]) continue;
    if (i * 2 > N) c1++;
    for (j = 2 * i; j <= N; j += i) pchk[j] = true;
    for (j = i; j <= N; j += i) {
      if (!mn[j]) mn[j] = i;
      int c = 0, t = j;
      while (t % i == 0) {
        c++;
        t /= i;
      }
      if (c == 1)
        val[j] *= -1;
      else
        val[j] = 0;
    }
  }
  for (i = 2; i <= N; i++)
    if (mn[i] * 2 <= N) sum[mn[i]]++;
  for (i = 1; i <= N; i++) sum[i] += sum[i - 1];
  long long v1 = 0, v2 = 0;
  for (i = 1; i <= N; i++) v1 += (long long)(N / i) * (N / i) * val[i];
  v2 = (long long)N * N - v1;
  v1 -= 2 * N - 1;
  v2 -= N - 1;
  v1 -= (long long)2 * c1 * (N - 2) - (long long)c1 * (c1 - 1);
  v1 /= 2, v2 /= 2;
  long long ans = v1 * 2 + v2;
  for (i = 2; i <= N; i++) {
    int t = max(i + 1, (N + i) / i);
    ans += (sum[i] - sum[i - 1]) * (sum[N] - sum[t - 1]);
    if (t <= i) ans -= (sum[i] - sum[i - 1]) * (sum[i] - sum[i - 1]);
  }
  return !printf("%lld\n", ans);
}