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>
const int MAXN = 10000000 + 10;
const int INF = 0x7fffffff;
const long long MOD = 1000000007;
using namespace std;
int miu[MAXN], sum[MAXN];
int vis[MAXN], prime[MAXN];
int fw[MAXN], mini[MAXN];
void prepare() {
  miu[1] = 1;
  memset(vis, 0, sizeof(vis));
  memset(mini, 0, sizeof(mini));
  memset(fw, 0, sizeof(fw));
  prime[0] = 0;
  for (int i = 2; i <= 10000000; i++) {
    if (vis[i] == 0) {
      prime[++prime[0]] = i;
      miu[i] = -1;
      mini[i] = i;
    }
    for (int j = 1; j <= prime[0]; j++) {
      if (i * prime[j] > 10000000) break;
      if (i % prime[j] != 0) miu[i * prime[j]] = miu[i] * miu[prime[j]];
      vis[i * prime[j]] = 1;
      if (mini[i * prime[j]] == 0)
        mini[i * prime[j]] = prime[j];
      else
        mini[i * prime[j]] = min(mini[i * prime[j]], prime[j]);
      if (i % prime[j] == 0) break;
    }
  }
  sum[0] = 0;
  for (int i = 1; i <= 10000000; i++) sum[i] = sum[i - 1] + miu[i];
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long get(int a, int b) {
  long long Ans = 0ll;
  int last = 1, cnt = 0;
  for (int i = 1; i <= min(a, b); i = last + 1) {
    last = min(a / (a / i), b / (b / i));
    Ans += (long long)((long long)(sum[last] - sum[i - 1]) *
                       (long long)(a / i) * (long long)(b / i));
    cnt++;
  }
  return Ans;
}
void Add(int v) {
  while (v <= 10000000) {
    fw[v]++;
    v += v & -v;
  }
}
int Sum(int v) {
  int res = 0;
  while (v > 0) {
    res += fw[v];
    v -= v & -v;
  }
  return res;
}
int main() {
  prepare();
  long long n;
  scanf("%lld", &n);
  long long Ans = 0ll, A = 0ll, B = 0ll, C = 0ll;
  A += (((n * (n - 1ll)) / 2ll) - ((get(n, n) - 1ll) / 2));
  int count = 1;
  for (int i = 1; i <= prime[0]; i++) {
    if (prime[i] > n) break;
    if (prime[i] * 2ll > n) count++;
  }
  C = (long long)(n - count) * (long long)(n - count - 1ll) / 2ll;
  for (int i = n; i >= 2; i--) {
    int tmp = (n / mini[i]);
    B += (long long)Sum(tmp);
    Add(mini[i]);
  }
  printf("%lld\n", A + 2ll * (long long)(B - A) + 3ll * (long long)(C - B));
  return 0;
}