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 = 1e7 + 7;
int n, m;
bool Prime[N];
int p[N >> 3], phi[N], mns[N], pin[N], tot, tnt[N];
void xxs(int x) {
  phi[1] = 1;
  for (int i = (2); i <= (x); ++i) {
    if (!Prime[i]) p[++tot] = i, phi[i] = i - 1, pin[i] = 1;
    for (int j = 1; j <= tot && p[j] * i <= x; j++) {
      Prime[p[j] * i] = 1, mns[p[j] * i] = p[j], pin[p[j] * i] = pin[i] + 1,
                   tnt[p[j]]++;
      if (i % p[j] == 0) {
        phi[p[j] * i] = phi[i] * p[j], pin[p[j] * i]--;
        break;
      }
      phi[p[j] * i] = phi[i] * (p[j] - 1);
    }
  }
}
long long ns;
int main() {
  cin >> n, xxs(n);
  int n2 = 0;
  for (int i = (1); i <= (tot); ++i)
    if (p[i] * 2 <= n) n2 = i;
  ns += (long long)3 * n2 * (n2 - 1) / 2;
  for (int i = (1); i <= (tot); ++i)
    for (int j = (i + 1); j <= (tot); ++j) {
      if ((long long)p[i] * p[j] > n) break;
      ns--;
    }
  int hs = 0;
  for (int i = (2); i <= (n); ++i)
    if (Prime[i]) ++hs, ns -= i - phi[i] - pin[i] - 1;
  ns += (long long)hs * (hs - 1);
  ns += (long long)n2 * hs * 3;
  for (int i = (1); i <= (tot); ++i)
    for (int j = (1); j <= (tot); ++j) {
      if ((long long)p[i] * p[j] > n) break;
      ns -= tnt[p[j]];
    }
  for (int i = (1); i <= (tot); ++i) {
    for (int j = p[i] * 2; j <= n; j += p[i]) {
      if ((long long)mns[j] * p[i] <= n)
        ns--;
      else
        ns++;
    }
  }
  cout << ns << "\n";
  return 0;
}