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 N = 10000005;
int miu[N], flag[N], b[N], tot, Cnt2[N], Cnt[N], n, Min[N];
void init() {
  miu[1] = 1;
  for (int i = 2; i < N; i++) {
    if (!flag[i]) {
      miu[i] = -1;
      Min[i] = i;
      b[++tot] = i;
    }
    for (int j = 1; j <= tot; j++) {
      int k = b[j] * i;
      if (k >= N) break;
      flag[k] = 1;
      if (i % b[j] == 0) {
        miu[k] = 0;
        Min[k] = Min[i];
        break;
      }
      miu[k] = -miu[i];
      Min[k] = min(Min[i], b[j]);
    }
  }
}
signed main() {
  scanf("%d", &n);
  init();
  int cnt = 1;
  for (int i = max(2, n / 2 + 1); i <= n; i++)
    if (!flag[i]) cnt++;
  long long ans = (long long)n * cnt * 2 - (long long)cnt * cnt;
  ans = -2 * ans;
  ans += (long long)n * n - n;
  ans += 2 * cnt;
  ans--;
  for (int i = 1; i <= n; i++) ans += (long long)miu[i] * (n / i) * (n / i);
  for (int i = 2; i <= n; i++)
    if (i * 2 <= n || flag[i]) Cnt[Min[i]]++;
  for (int i = n; i; i--) Cnt2[i] = Cnt2[i + 1] + Cnt[i];
  for (int i = n; i; i--) {
    ans += (long long)Cnt[i] * Cnt2[n / i + 1];
    if ((long long)i * i > n) ans -= Cnt[i] * Cnt[i];
  }
  ans /= 2;
  printf("%lld\n", ans);
}