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;
int Phi[10000002], N, MinP[10000005], number, Nb[10000005], Ind[10000005],
    Prime[10000005], Partial[10000005], cnt;
void Eratostene() {
  int i, j;
  for (i = 1; i <= N; i++) Phi[i] = i - 1;
  for (i = 2; i <= N; i++) {
    if (MinP[i] == 0) {
      Prime[++cnt] = i;
      Nb[cnt] = 1;
      if (i <= N / 2) number = cnt;
    }
    for (j = i + i; j <= N; j += i) {
      Phi[j] -= Phi[i];
      if (MinP[i] == 0 && MinP[j] == 0) MinP[j] = i, Nb[cnt]++;
    }
  }
  for (int i = cnt; i >= 1; i--) {
    Partial[i] = Partial[i + 1] + Nb[i];
  }
}
void Solve() {
  long long ans = 1LL * (N - 1) * (N - 2);
  for (int i = 2; i <= N; i++) {
    ans -= (i - 1 - Phi[i]);
    if (MinP[i] == 0) continue;
    if (MinP[i / MinP[i]] == 0) {
      ++Ind[MinP[i]];
      if (i / MinP[i] != MinP[i]) ++Ind[i / MinP[i]];
    }
  }
  for (int i = 1; i <= cnt; i++) {
    int pos = Ind[Prime[i]];
    ans -= (1LL * Nb[i] * Partial[pos + 1]);
    if (Prime[Ind[Prime[i]]] < Prime[i]) ans++;
    if (max(pos + 1, i + 1) <= number) {
      ans +=
          (3LL * Nb[i] * (Partial[max(pos + 1, i + 1)] - Partial[number + 1]));
    }
  }
  cout << ans << "\n";
}
int main() {
  cin >> N;
  Eratostene();
  Solve();
  return 0;
}