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 ans;
int n, m, i, j, p[10000005], md[10000005], np[10000005], pc, cmd[10000005],
    smd[10000005], mu[10000005], cnt[10000005];
long long solve1() { return 1ll * cnt[n] * (cnt[n] - 1) / 2; }
long long solve2() {
  long long ans = 0;
  int i;
  for ((i) = 1; (i) <= (n); ++(i)) {
    if (i != 1)
      ans += 1ll * mu[i] * (n / i) * (n / i - 1);
    else
      ans += 1ll * mu[i] * (cnt[n]) * (cnt[n] - 1);
  }
  return ans / 2;
}
long long solve3() {
  long long ans = 0;
  int i, j = n;
  for ((i) = 1; (i) <= (n); ++(i)) {
    while (1ll * i * j > n) j--;
    ans += 1ll * cmd[i] * (smd[n] - smd[j]);
    if (i != 1 && 1ll * md[i] * 2 <= n && 1ll * md[i] * md[i] > n) ans--;
  }
  return ans / 2;
}
signed main() {
  scanf("%lld", &n);
  mu[1] = 1;
  md[1] = n + 1;
  for ((i) = (2); (i) <= (n); ++(i)) {
    if (!np[i]) {
      p[++pc] = i;
      md[i] = i;
      mu[i] = -1;
    }
    for ((j) = 1; (j) <= (pc); ++(j)) {
      if (i * p[j] > n) break;
      np[i * p[j]] = 1;
      md[i * p[j]] = p[j];
      mu[i * p[j]] = -mu[i];
      if (i % p[j] == 0) {
        mu[i * p[j]] = 0;
        break;
      }
    }
  }
  for ((i) = 1; (i) <= (n); ++(i)) {
    if (md[i] * 2 <= n) {
      cnt[i]++;
      cmd[md[i]]++;
    }
  }
  for ((i) = 1; (i) <= (n); ++(i)) {
    cnt[i] += cnt[i - 1];
    smd[i] = cmd[i] + smd[i - 1];
  }
  cout << solve1() + solve2() + solve3() << endl;
  return 0;
}