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 + 5, M = 4e6 + 5;
int n, ct, f[N], k[N], q[N], fi[N], c[M];
long long sum = 0, ans = 0, tot[N];
int Max(int x, int y) { return x > y ? x : y; }
void Oula() {
  for (int i = 2; i <= n; i++) {
    if (!f[i]) k[i] = i, c[++ct] = i, fi[i] = i - 1;
    for (int j = 1; j <= ct && (long long)i * c[j] <= n; j++) {
      f[i * c[j]] = 1;
      k[i * c[j]] = (k[i] < c[j] ? k[i] : c[j]);
      if (i % c[j] == 0) {
        fi[i * c[j]] = fi[i] * c[j];
        break;
      } else
        fi[i * c[j]] = fi[i] * (c[j] - 1);
    }
    q[k[i]]++;
    sum += fi[i] - 1;
  }
  for (int i = 2; i <= n; i++) tot[i] = tot[i - 1] + q[i];
}
int main() {
  scanf("%d", &n);
  Oula();
  ans += (long long)(n - 1) * (n - 2) / 2;
  ans -= sum;
  for (int i = 2; i <= ct; i++) {
    int x = c[i];
    if (n / 2 < Max(x + 1, n / x + 1)) break;
    ans += (long long)(tot[n / 2] - tot[Max(x + 1, n / x + 1) - 1]) * q[x] * 3;
    sum -= (long long)(tot[n / 2] - tot[Max(x + 1, n / x + 1) - 1]) * q[x];
  }
  for (int i = 1; i <= ct; i++) {
    int x = c[i];
    if (n < Max(x + 1, n / 2 + 1)) break;
    sum -= (long long)(tot[n] - tot[Max(x + 1, n / 2 + 1) - 1]) * q[x];
  }
  ans += sum * 2;
  printf("%lld\n", ans);
  return 0;
}