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 n;
int prime[10000011 / 10], lp = 0, phi[10000011], small[10000011],
                          sum[2][10000011], sonofbitch[2][10000011];
bool notprime[10000011];
void pre(int n) {
  phi[1] = 1;
  sum[0][1] = sum[1][1] = 0;
  for (int i = 2; i <= n; i++) {
    sum[0][i] = sum[0][i - 1] + (!notprime[i] && i * 2 <= n);
    sum[1][i] = sum[1][i - 1] + (!notprime[i]);
    if (!notprime[i]) {
      prime[++lp] = i;
      phi[i] = i - 1;
      sonofbitch[0][i] = (i * 2 <= n);
      sonofbitch[1][i] = 1;
      small[i] = i;
    }
    for (int j = 1; j <= lp && 1ll * i * prime[j] <= n; j++) {
      notprime[i * prime[j]] = 1;
      small[i * prime[j]] = prime[j];
      if (i % prime[j]) {
        phi[i * prime[j]] = phi[i] * (prime[j] - 1);
        sonofbitch[0][i * prime[j]] = sonofbitch[0][i] + (prime[j] * 2 <= n);
        sonofbitch[1][i * prime[j]] = sonofbitch[1][i] + 1;
      } else {
        phi[i * prime[j]] = phi[i] * prime[j];
        sonofbitch[0][i * prime[j]] = sonofbitch[0][i];
        sonofbitch[1][i * prime[j]] = sonofbitch[1][i];
        break;
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  pre(n);
  long long tot1 = 0, tot2 = 0, tot3 = 0, m = n - (sum[1][n] - sum[0][n]) - 1,
            tot = m * 1ll * (m - 1) / 2;
  for (int i = 2; i <= n; i++) tot1 += i - 1 - phi[i];
  for (int i = 2; i <= n; i++)
    if (notprime[i])
      tot2 += phi[i] - sum[1][i] + sonofbitch[1][i] - 1 + sum[0][n / small[i]] -
              sonofbitch[0][i];
    else if (i * 2 <= n)
      tot2 += sum[0][min(i - 1, n / i)];
  tot3 = tot - tot1 - tot2;
  printf("%lld\n", tot1 + tot2 * 2 + tot3 * 3);
  return 0;
}