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>
#pragma comment(linker, "/STACK:536870912")
#pragma warning(disable : 4996)
using namespace std;
const int N = 1e7 + 100, M = 1e6, S = 1e4, D = 1e5, INF = 1e9;
bool com[N];
int pr[M], z[D], c[D], phi[N], q[N + N];
int ct = 0, ss = 0;
int main() {
  for (int i = 2; i < S; i++) {
    if (!com[i]) {
      pr[ct++] = i;
      for (int j = i * i; j < S; j += i) com[j] = 1;
    }
  }
  int n;
  scanf("%d", &n);
  long long int ans = 0;
  int t = 0, sq = 0;
  for (int i = 2; i <= n; i++) {
    int b = sqrt(i), fir = -1;
    for (int j = 0; pr[j] <= b; j++) {
      if (i % pr[j] == 0) {
        fir = pr[j];
        phi[i] = phi[i / pr[j]] * pr[j];
        if (i / pr[j] % pr[j]) phi[i] -= phi[i] / pr[j];
        break;
      }
    }
    if (fir == -1) fir = i, phi[i] = i - 1;
    if (fir * 2 <= n) t++;
    if (fir * (long long int)fir <= n) ans++;
    q[sq++] = fir * 2;
    q[sq++] = n / fir * 2 + 1;
  }
  sort(q, q + sq);
  for (int i = 0, sum = 0; i < sq; i++) {
    if (q[i] & 1)
      ans -= sum;
    else
      sum++;
  }
  ans /= 2;
  for (int i = 1; i <= n; i++) ans -= i - 1 - phi[i];
  ans += t * (t - 1ll) / 2 * 3;
  printf("%lld", ans);
  return 0;
}