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;
vector<int> p;
int c[10000010];
int d[10000010];
int fi[10000010];
int sm[10000010];
int main() {
  int n, i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) fi[i] = i;
  for (i = 2; i <= n; i++) {
    sm[i] = i;
    if (fi[i] != i) continue;
    p.push_back(i);
    for (j = i; j <= n; j += i) fi[j] -= fi[j] / i;
  }
  long long ans = n - 1;
  for (i = 0; i < p.size(); i++)
    if (p[i] > n / 2) ans--;
  ans = ans * (ans - 1) / 2;
  long long q1 = 0, q2 = 0;
  for (i = 2; i <= n; i++) {
    q1 += i - 1 - fi[i];
    if (fi[i] != i - 1) continue;
    c[i] = 1;
    if (i * 1ll * i > n) continue;
    for (j = i * i; j <= n; j += i)
      if (sm[j] == j) c[i]++, sm[j] = i;
  }
  for (i = 0; i < p.size(); i++) d[i] = c[p[i]];
  for (i = 1; i < p.size(); i++) d[i] += d[i - 1];
  for (i = 0; i < p.size(); i++) {
    int x = upper_bound(p.begin(), p.end(), n / p[i]) - p.begin();
    if (x == 0) continue;
    x--;
    if (x < i) break;
    q2 += c[p[i]] * 1ll * (d[x] - d[i]);
    q2 += c[p[i]] * 1ll * (c[p[i]] - 1) / 2;
  }
  q2 = q2 - q1;
  ans = q1 + q2 * 2 + (ans - q1 - q2) * 3;
  printf("%lld\n", ans);
  return 0;
}