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 long long N = 10000005;
long long n, p[N], tot, phi[N], m, be[N];
bool is[N];
long long a[5000];
long long ans, num;
void init() {
  p[1] = 1;
  for (long long i = 2; i <= n; i++) {
    if (!is[i]) {
      p[++tot] = i;
      phi[i] = i - 1;
      be[i] = i;
    }
    for (long long j = 1; j <= tot && i * p[j] <= n; j++) {
      be[p[j] * i] = p[j];
      is[p[j] * i] = 1;
      if (i % p[j] == 0) {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      } else
        phi[i * p[j]] = phi[i] * phi[p[j]];
    }
  }
  for (long long i = 2; i <= n; i++) {
    if (be[i] <= m) a[be[i]]++;
  }
}
void cal_1_4() {
  num = (n - 1) * (n - 2) / 2;
  long long cc = 0;
  for (long long i = 1; i <= tot; i++) {
    if (p[i] > n / 2) {
      cc = tot - i + 1;
      break;
    }
  }
  num -= 1ll * (n - 2) * cc - 1ll * cc * (cc - 1) / 2;
  for (long long i = 2; i <= n; i++) {
    ans += i - 1 - phi[i];
    num -= i - 1 - phi[i];
  }
}
void cal_3() {
  long long cc = 0, tt = 0, kk = 0;
  for (long long i = 1; i <= tot; i++) {
    if (p[i] > n / 2) break;
    if (p[i] <= m) continue;
    if (p[i - 1] <= m || n / p[i] != n / p[i - 1]) {
      for (long long j = 1; j <= m; j++) {
        if (j * p[i] > n) cc += a[j], a[j] = 0;
      }
    }
    tt += cc;
    kk++;
  }
  tt += kk * (kk - 1) / 2;
  ans += tt * 3;
  num -= tt;
  ans += num * 2;
}
signed main() {
  cin >> n;
  m = sqrt(n);
  if (n == 1) cout << 0, exit(0);
  init();
  cal_1_4();
  cal_3();
  cout << ans << endl;
}