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 maxn = 1e7 + 100;
int n, m;
long long ans, a, b, c;
bool isp[maxn];
int p[maxn], cnt[maxn], phi[maxn], cnt2[maxn];
void pre() {
  phi[1] = 1;
  for (int i = 2; i <= n; ++i) {
    isp[i] = 1;
  }
  for (int i = 2; i <= n; ++i) {
    if (isp[i]) {
      phi[i] = i - 1;
      p[m++] = i;
    }
    for (int j = 0; j < m; ++j) {
      if (1ll * p[j] * i > n) {
        break;
      }
      int x = p[j] * i;
      ++cnt[p[j]];
      isp[x] = 0;
      if (i % p[j] == 0) {
        phi[x] = phi[i] * p[j];
        break;
      }
      phi[x] = phi[i] * phi[p[j]];
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    cnt[i] += cnt[i + 1];
  }
  return;
}
int main() {
  scanf("%d", &n);
  pre();
  if (n <= 3) {
    puts("0");
    return 0;
  }
  for (int i = 2; i <= n; ++i) {
    if (isp[i] && i * 2 > n) {
      continue;
    }
    ++b;
    a += (i - phi[i] - 1);
    if (isp[i]) {
      cnt2[i] = 1;
      c += cnt[n / i + 1];
    }
  }
  for (int i = n - 1; i > 1; --i) {
    cnt2[i] += cnt2[i + 1];
  }
  for (int i = 2; i <= n; ++i) {
    if (isp[i] && i * 2 <= n) {
      int j = n / i + 1;
      if (j < i) {
        c += cnt2[j] - cnt2[i];
      }
    }
  }
  b = b * (b - 1) / 2 - a - c;
  printf("%I64d\n", a + b * 2 + c * 3);
  return 0;
}