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 = 10000010;
int to[N];
bool vis[N];
int n;
int sum[N];
long long a, b, c, d, e, f;
int cur;
int main() {
  for (int i = 1; i < N; i++) {
    to[i] = i;
  }
  for (int i = 2; i < N; i++) {
    if (to[i] != i) continue;
    for (int j = i; j < N; j += i) {
      to[j] = to[j] - (to[j] / i);
    }
  }
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    b += (i - 1 - to[i]);
    if (to[i] != i - 1) {
      sum[i] = sum[i - 1];
      continue;
    }
    if (i * 2 > n) {
      a++;
    }
    if ((long long)i * i > n) f++;
    for (int j = i; j <= n; j += i) {
      if ((long long)i * i > n && j != i) e++;
      if (vis[j]) continue;
      vis[j] = true;
      sum[i]++;
    }
    sum[i] += sum[i - 1];
  }
  a = (a + 1) * (n - a - 1) + a * (a + 1) / 2;
  c = (long long)(n - f - 1) * (n - f - 2) / 2;
  c -= (b - e);
  for (int i = 2; i * 2 <= n; i++) {
    if (to[i] != i - 1) continue;
    if ((long long)i * i <= n) continue;
    cur = n / i;
    c += sum[cur];
  }
  c -= e;
  d = (long long)n * (n - 1) / 2;
  d -= (a + b + c);
  long long ans = b + 2 * c + 3 * d;
  cout << ans << endl;
  return 0;
}