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 ll = long long;
const int C = 10000001;
void supfactor(int* pr, int v) {
  int i, j;
  pr[1] = 1;
  for (i = 2; i * i < v; i++) {
    if (pr[i] == 0) {
      for (j = i; j < v; j += i) {
        if (pr[j] == 0) pr[j] = i;
      }
    }
  }
  for (; i < v; i++)
    if (pr[i] == 0) pr[i] = i;
}
void mobiusize(int pr[], int mobius[], int v) {
  int i, j, ij;
  for (i = 1; i < v; i++) mobius[i] = -1;
  for (i = 2; i < v; i++) {
    if (i == pr[i]) {
      for (j = i, ij = 1; j < v; j += i, ij++) {
        if (ij % i != 0)
          mobius[j] *= (-1);
        else
          mobius[j] = 0;
      }
    }
  }
}
int primes[C], dead[C], mobius[C], csc_primes[C], csc_non_primes[C];
int main() {
  ll n, i, j, t0 = 0, t1 = 0, t2 = 0, t3 = 0, funerals = 0, amount = 0, tpr = 0,
              tnpr = 0;
  scanf("%lld", &n);
  supfactor(primes, C);
  for (i = 2; i <= n; i++) {
    if (i * 2 > n && primes[i] == i) dead[i] = 1, funerals++;
  }
  if (dead[1] == 0) dead[1] = 1, funerals++;
  t0 = funerals * (n - 1) - (funerals * (funerals - 1)) / 2;
  mobiusize(primes, mobius, C);
  for (i = 2; i <= n; i++) {
    amount = n / i;
    t1 += mobius[i] * (amount * (amount - 1)) / 2;
  }
  for (i = 1; i <= n; i++) {
    if (dead[i] == 1) continue;
    if (primes[i] != i)
      csc_non_primes[primes[i]]++;
    else
      csc_primes[primes[i]]++;
  }
  for (i = n - 1; i > 0; i--) csc_non_primes[i] += csc_non_primes[i + 1];
  for (i = n - 1; i > 0; i--) csc_primes[i] += csc_primes[i + 1];
  for (i = 2; i <= n; i++) {
    if (primes[i] == i && dead[i] == 0) {
      tpr += csc_primes[n / i + 1];
      tnpr += csc_non_primes[n / i + 1];
      for (j = i + i; j <= n; j += i) {
        if (primes[j] * i > n) tnpr--;
      }
      if (i * i > n) tpr--;
    }
  }
  t3 = tnpr + tpr / 2;
  t2 = n * (n - 1) / 2 - t0 - t1 - t3;
  printf("%lld\n", t1 + 2 * t2 + 3 * t3);
  return 0;
}