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 = 1e7 + 17;
int f[N], s[N], p[N];
long long g[N], s0, s1, s2, s3, ans;
int main() {
  int n, i, j, t;
  cin >> n;
  t = n - 1;
  for (i = 2; i <= n; i = i + 1) {
    if (!f[i]) {
      f[i] = i;
      for (j = i + i; j <= n; j = j + i)
        if (!f[j]) f[j] = i;
      if (i + i > n)
        t--;
      else
        p[f[i]]++;
    } else
      p[f[i]]++;
  }
  s0 = (long long)n * (n - 1) / 2 - (long long)t * (t - 1) / 2;
  for (i = n; i >= 1; i = i - 1) {
    g[i] = (long long)(n / i) * (n / i - 1) / 2;
    for (j = i + i; j <= n; j = j + i) g[i] -= g[j];
  }
  s1 = (long long)n * (n - 1) / 2 - g[1];
  for (i = 1; i <= n; i = i + 1) s[i] = s[i - 1] + p[i];
  s3 = (long long)t * (t - 1);
  for (i = 1; i <= n; i = i + 1) s3 -= (long long)p[i] * s[n / i];
  for (i = 2; i <= n; i = i + 1)
    if (f[i] != i || i + i <= n)
      if ((long long)f[i] * f[i] <= n) s3++;
  s3 = s3 / 2;
  s2 = g[1] - s3 - s0;
  ans = s1 + s2 * 2 + s3 * 3;
  cout << ans;
  return 0;
}