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 mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const long long N = 10000000;
int pr[N / 5], p[N + 100], tot, mu[N + 100], phi[N + 100], n;
void init() {
  mu[1] = 1;
  p[1] = 1;
  phi[1] = 1;
  for (int i = 2; i < N + 1; i++) {
    if (!p[i]) p[i] = i, pr[++tot] = i, mu[i] = -1, phi[i] = i - 1;
    ;
    for (int j = 1; j <= tot && pr[j] * i <= N; j++) {
      p[i * pr[j]] = pr[j];
      if (p[i] == pr[j]) {
        phi[i * pr[j]] = phi[i] * pr[j];
        break;
      } else {
        mu[i * pr[j]] = -mu[i];
        phi[i * pr[j]] = phi[i] * (pr[j] - 1);
      }
    }
  }
}
long long calc1() {
  long long ret = 0;
  for (int i = 2; i < n + 1; i++) ret += i - phi[i] - 1;
  return ret;
}
long long calc0() {
  long long ret = 0, u = 0;
  for (int i = 1; i < n + 1; i++) {
    if (i == 1 || (2 * i > n && p[i] == i)) {
      ret += i - 1;
      u++;
    } else {
      ret += u;
    }
  }
  return ret;
}
int cnt[N + 100];
long long calc2() {
  long long sm = 0;
  for (int d = 1; d < n + 1; d++)
    if (mu[d]) {
      long long ret = 0;
      if (n / d >= 100000) {
        int mv = 0;
        for (int i = d; i <= n; i += d) mv = max(mv, p[i]);
        for (int i = 1; i < mv + 1; i++) cnt[i] = 0;
        for (int i = d; i <= n; i += d) cnt[p[i]]++;
        for (int i = 1; i < mv + 1; i++) cnt[i] += cnt[i - 1];
        for (int i = 1; i < mv + 1; i++)
          if (cnt[i] != cnt[i - 1])
            ret += (long long)(cnt[i] - cnt[i - 1]) * cnt[min(mv, n / i)];
      } else {
        tot = 0;
        for (int i = d; i <= n; i += d) cnt[tot++] = p[i];
        sort(cnt, cnt + tot);
        int r = tot - 1;
        for (int i = 0; i < tot; i++) {
          while (r >= 0 && (long long)cnt[i] * cnt[r] > n) --r;
          ret += r + 1;
        }
      }
      sm += mu[d] * ret;
    }
  return (sm + 1) / 2 - n;
}
int main() {
  init();
  scanf("%d", &n);
  long long tot = (long long)n * (n - 1) / 2;
  long long t1 = calc1();
  long long t0 = calc0();
  long long t2 = calc2();
  long long t3 = tot - t1 - t0 - t2;
  printf("%lld\n", t1 + t2 * 2 + t3 * 3);
}