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 Max_N(10000000 + 5);
int N, ps, P[Max_N], phi[Max_N], MinP[Max_N], V[Max_N];
bool Prime[Max_N];
long long int Ans1, Ans2, Ans3, Tmp;
int main() {
  scanf("%d", &N);
  memset(Prime, true, sizeof(Prime)), Prime[0] = Prime[1] = false, phi[1] = 1;
  for (int i = 2; i <= N; ++i) {
    if (Prime[i]) P[++ps] = i, phi[i] = i - 1, MinP[i] = i;
    for (int j = 1; j <= ps && i * P[j] <= N; ++j) {
      Prime[i * P[j]] = false;
      MinP[i * P[j]] = P[j];
      if (i % P[j])
        phi[i * P[j]] = phi[i] * phi[P[j]];
      else {
        phi[i * P[j]] = phi[i] * P[j];
        break;
      }
    }
    Ans1 += i - 1 - phi[i], ++V[MinP[i]];
  }
  Tmp = V[1];
  for (int p = N, q = 1; p >= 1; --p) {
    while (p * (q + 1) <= N) Tmp += V[++q];
    Ans2 += V[p] * Tmp;
    if ((p * 1LL) * (p * 1LL) <= N) Ans2 -= V[p];
  }
  Ans2 /= 2LL;
  Tmp = 0LL;
  for (int p = 1; 2 * p <= N; ++p) {
    Tmp += V[p];
    Ans3 += V[p] * Tmp - ((V[p] * 1LL) * (V[p] - 1LL) / 2LL + V[p]);
  }
  printf("%I64d", Ans1 * 1LL + (Ans2 - Ans1) * 2LL + (Ans3 - Ans2) * 3LL);
  return 0;
}