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 long long N = 1e7 + 10, M = 1e6 + 100;
;
long long n, v[N], p[M], w, mu[N], sum[M];
long long cnt[M], pos, tr[N], to[M];
inline long long get1(long long n) {
  long long ans = 0;
  for (long long l = 1, r; l <= n; l = r + 1) {
    r = n / (n / l);
    ans += 1ll * (mu[r] - mu[l - 1]) * (n / l) * (n / l);
  }
  ans = (ans - 1) / 2;
  return ans;
}
inline long long get3(long long n) {
  long long ans = 0;
  for (long long i = 1, j = pos; i <= pos; i++) {
    while (p[j] > n / p[i] && j >= 1) j--;
    ans += 1ll * (sum[i] - sum[i - 1]) * (sum[pos] - sum[j]);
  }
  for (long long i = 1; i <= pos; i++)
    if (p[i] > n / p[i])
      ans -= 1ll * (sum[i] - sum[i - 1]) * (sum[i] - sum[i - 1]);
  ans /= 2;
  return ans;
}
inline long long get0(long long n) {
  long long ans = 0;
  for (long long i = 1, j = w; i <= w; i++) {
    while (p[j] > n / p[i] && j >= 1) j--;
    if (i > pos)
      ans += 1ll * (sum[i] - sum[i - 1]) * (sum[w] - sum[j]);
    else
      ans += 1ll * (sum[i] - sum[i - 1]) * (sum[w] - sum[max(pos, j)]);
  }
  for (long long i = pos + 1; i <= w; i++)
    if (p[i] > n / p[i])
      ans -= 1ll * (sum[i] - sum[i - 1]) * (sum[i] - sum[i - 1]);
  ans /= 2;
  return ans;
}
signed main() {
  scanf("%lld", &n);
  mu[1] = 1;
  v[1] = 1;
  for (long long i = 2; i <= n; i++) {
    if (!v[i]) {
      v[i] = p[++w] = i;
      tr[i] = w;
      sum[w]++;
      mu[i] = -1;
    }
    for (long long j = 1; j <= w; j++) {
      if (p[j] > v[i] || p[j] > n / i) break;
      sum[j]++;
      v[p[j] * i] = p[j];
      if (i % p[j] == 0)
        mu[i * p[j]] = 0;
      else
        mu[i * p[j]] = -mu[i];
    }
  }
  for (long long i = 1; i <= n; i++) mu[i] += mu[i - 1];
  for (long long i = 1; i <= w; i++)
    if (p[i] + p[i] <= n) pos = i;
  for (long long i = 1; i <= w; i++) sum[i] += sum[i - 1];
  long long one, zero, two, three;
  one = 1ll * n * (n - 1) / 2 - get1(n);
  three = get3(n);
  zero = get0(n);
  two = 1ll * (n - 2) * (n - 1) / 2 - one - zero - three;
  printf("%lld\n", one + two * 2 + three * 3);
}