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 = 10000010;
int pri[N / 5], mn[N], sx[N], phi[N], sp[N], sn[N];
int n, num, m;
long long cnt0, cnt1, cnt2, cnt3, tot, now;
inline int min(const int &a, const int &b) { return a < b ? a : b; }
int main() {
  scanf("%d", &n);
  int i, j;
  phi[1] = mn[1] = 1;
  for (i = 2; i <= n; i++) {
    if (!sx[i]) {
      pri[++num] = i, mn[i] = i, phi[i] = i - 1, sx[i] = 1;
      if (i <= n / 2) m = num;
    }
    sp[i] = num;
    for (j = 1; j <= num && i * pri[j] <= N; j++) {
      mn[i * pri[j]] = pri[j];
      if (i % pri[j] == 0) {
        sx[i * pri[j]] = sx[i], phi[i * pri[j]] = phi[i] * pri[j];
        break;
      }
      sx[i * pri[j]] = sx[i] + 1, phi[i * pri[j]] = phi[i] * (pri[j] - 1);
    }
  }
  tot = 1ll * (n - 1) * (n - 2) / 2;
  for (i = m + 1; i <= num; i++) cnt0 += pri[i] - 2 + n - pri[i] - (num - i);
  for (i = 2; i <= n; i++) cnt1 += i - 1 - phi[i];
  for (i = 2; i <= n; i++)
    if (mn[i] != i) cnt2 += phi[i] - sp[i] + sx[i] - 1;
  for (i = 2; i <= n; i++)
    if (mn[i] != i) {
      cnt2 += min(m, sp[n / mn[i]]);
      if (1ll * mn[i] * mn[i] <= n) cnt2--;
    }
  for (j = 2, i = m; i >= 1; i--) {
    for (; j <= n / pri[i]; j++)
      if (mn[j] < pri[i]) sn[mn[j]]++, now++;
    now -= sn[pri[i]];
    cnt2 -= now;
  }
  for (i = 1; i <= m; i++)
    for (j = 1; j < i && pri[i] * pri[j] <= n; j++) cnt2++;
  cnt3 = tot - cnt0 - cnt1 - cnt2;
  printf("%lld", cnt1 + cnt2 * 2 + cnt3 * 3);
  return 0;
}