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;
int phi[10000005], mn[10000005], app[10000005], p[10000005], bad_cnt;
bool bad[10000005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) phi[i] = i;
  for (int i = 2; i <= n; i++) {
    if (mn[i]) continue;
    mn[i] = i;
    phi[i] = i - 1;
    for (int j = i + i; j <= n; j += i) {
      if (!mn[j]) mn[j] = i;
      phi[j] = phi[j] / i * (i - 1);
    }
  }
  long long one = 0, two = 0;
  for (int i = 1; i <= n; i++) {
    if (i == 1 || (mn[i] == i && 2 * i > n)) {
      bad[i] = true;
      bad_cnt++;
    }
    if (i == 1) continue;
    if (mn[i] == i)
      p[i] = 1;
    else if (mn[i / mn[i]] == mn[i])
      p[i] = p[i / mn[i]];
    else
      p[i] = p[i / mn[i]] + 1;
    if (!bad[i]) {
      one += i - 1 - phi[i];
      app[mn[i]]++;
    }
  }
  int cnt = 1;
  for (int i = 2; i <= n; i++) {
    if (mn[i] != i)
      two += phi[i] - cnt + p[i];
    else
      cnt++;
    app[i] += app[i - 1];
  }
  for (int i = 2; i <= n; i++) {
    if (mn[i] != i || bad[i]) continue;
    two += app[n / i];
    for (int j = i; j <= n; j += i) two -= mn[j] <= n / i;
  }
  for (int i = 2; i <= n; i++) {
    int x = mn[i], y = i / x;
    if (y != 1 && mn[y] == y && x != y) two--;
  }
  printf(
      "%lld\n",
      one + two * 2 +
          ((long long)(n - bad_cnt) * (n - bad_cnt - 1) / 2 - one - two) * 3);
  return 0;
}