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 = 10000001;
int pri[N], p[N], sp[N], is[N], phi[N];
long long n, cnt0, cnt1, cnt2, cnt3, bad_p;
int main() {
  int i, j, k;
  scanf("%I64d", &n);
  cnt1 = n * (n - 1) / 2;
  for (i = 2; i <= n; i++) {
    if (is[i] == 0) {
      if (i * 2 > n) bad_p++;
      p[i] = i, phi[i] = i - 1;
      pri[++pri[0]] = i;
    }
    for (j = 1; j <= pri[0] && (long long)i * pri[j] <= n; j++) {
      k = i * pri[j], is[k] = 1, p[k] = pri[j];
      phi[k] = phi[i] * (pri[j] - 1);
      if (i % pri[j] == 0) {
        phi[k] = phi[i] * pri[j];
        break;
      }
    }
    sp[i] = sp[i - 1] + (is[i] ^ 1);
    cnt1 -= phi[i];
  }
  cnt0 = n - bad_p - 1 + n * (n - 1) / 2 - (n - bad_p) * (n - bad_p - 1) / 2;
  for (i = 2; i <= pri[0]; i++)
    for (j = 1; (long long)pri[i] * pri[j] <= n && j < i; j++) cnt2++;
  for (i = 4; i <= n; i++) {
    if (is[i] == 0) continue;
    cnt2 += sp[n / p[i]];
    cnt2 += phi[i] - 1 - sp[i];
  }
  cnt3 = n * (n - 1) / 2 - cnt0 - cnt1 - cnt2;
  printf("%I64d\n", cnt1 + 2 * cnt2 + 3 * cnt3);
  return 0;
}