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 + 10;
int n, prime[N], phi[N], u[N], Min[N], cnt;
bool isp[N];
long long C2(long long n) { return n * (n - 1) / 2; }
long long d0() {
  int m = 1;
  for (int i = 1; i <= cnt; i++)
    if (prime[i] * 2 > n) m++;
  return 1ll * m * (n - 1) - C2(m);
}
long long d1() {
  long long ans = C2(n);
  for (int i = 1; i <= n; i++) ans -= phi[i];
  return ans + 1;
}
int q[N], size;
long long calc(int d) {
  long long ans = 0;
  size = 0;
  for (int i = max(d, 2); i <= n; i += d) q[++size] = Min[i];
  sort(q + 1, q + size + 1);
  for (int i = 1, j = size; i <= size; i++) {
    while ((long long)q[i] * q[j] > n) j--;
    ans += j;
    if ((long long)q[i] * q[i] <= n) ans--;
  }
  return ans / 2;
}
long long d2() {
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    if (u[i]) ans += u[i] * calc(i);
  return ans;
}
int main() {
  scanf("%d", &n);
  phi[1] = u[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!isp[i]) {
      prime[++cnt] = i;
      phi[i] = i - 1;
      Min[i] = i;
      u[i] = -1;
    }
    for (int j = 1; j <= cnt && i * prime[j] <= n; j++) {
      int x = i * prime[j];
      isp[x] = 1;
      Min[x] = prime[j];
      if (i % prime[j]) {
        phi[x] = phi[i] * (prime[j] - 1);
        u[x] = -u[i];
      } else {
        phi[x] = phi[i] * prime[j];
        u[x] = 0;
        break;
      }
    }
  }
  long long a0 = d0(), a1 = d1(), a2 = d2(), a3 = C2(n) - a0 - a1 - a2;
  printf("%lld\n", a1 + a2 * 2 + a3 * 3);
  return 0;
}