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;
long long n, m, nn, mm;
signed phi[10000005];
signed p[10000005];
signed a[10000005], r[10000005], c[10000005];
bool isp[10000005];
long long ans;
void QAQ() {
  mm = n;
  isp[1] = 1;
  for (long long i = 2; i <= n; i++) {
    if (isp[i] == 0) {
      nn++;
      p[nn] = i;
      a[i] = i;
      if (i * 2 > n) {
        mm--;
      }
    }
    for (long long j = 1; j <= nn; j++) {
      if (i * p[j] > n) break;
      isp[i * p[j]] = 1;
      a[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
  for (long long i = 2; i <= n; i++) c[a[i]]++;
  phi[1] = 1;
  for (long long i = 2; i <= n; i++) {
    if (!isp[i]) {
      phi[i] = i - 1;
      continue;
    }
    if ((i / a[i]) % a[i] == 0)
      phi[i] = phi[i / a[i]] * (a[i]);
    else
      phi[i] = phi[i / a[i]] * (a[i] - 1);
  }
  for (long long i = 1; i <= n; i++) c[i] += c[i - 1];
}
long long QwQ(long long l, long long r) {
  if (r < l) return 0;
  return c[r] - c[l - 1];
}
signed main() {
  cin >> n;
  QAQ();
  long long fk = 0, md;
  for (long long i = 2; i <= n; i++) {
    fk += 1ll * (phi[i] - 1);
  }
  md = ((n - 1) * (n - 2)) >> 1;
  md -= fk;
  ans = fk * 2 + md;
  long long cnt = 0;
  for (long long i = 1; i <= nn; i++) {
    ;
    long long yy = 1ll * (c[p[i]] - c[p[i] - 1]);
    ans += 1ll * yy *
           QwQ(max(1ll * (p[i] + 1), n / p[i] + 1),
               max(1ll * (p[i] + 1), (n >> 1) + 1) - 1);
    ans -= 2 * yy * QwQ(max(1ll * (p[i] + 1), (n >> 1) + 1), n);
  }
  cout << ans;
  return 0;
}