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.
#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chkmax(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <typename T>
bool chkmin(T &x, T y) {
  return x > y ? x = y, true : false;
}
int readint() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, tot;
int mu[10000005], cnt[10000005], p0[10000005], prm[1000005];
bool fl[10000005];
void getprime() {
  fl[1] = mu[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!fl[i]) prm[++tot] = i, p0[i] = i, mu[i] = -1;
    for (int j = 1; j <= tot && i * prm[j] <= n; j++) {
      fl[i * prm[j]] = 1, p0[i * prm[j]] = prm[j];
      if (i % prm[j] == 0) {
        mu[i * prm[j]] = 0;
        break;
      }
      mu[i * prm[j]] = -mu[i];
    }
  }
}
int main() {
  n = readint();
  getprime();
  long long a1 = 0, ans = 0;
  for (int i = 1; i <= n; i++) a1 += mu[i] * (n / i) * (n / i);
  ans += n * (n - 1) / 2 - (a1 - 1) / 2;
  a1 -= n + n - 1, a1 /= 2;
  long long tmp = n - 1;
  for (int i = 1; i <= tot; i++)
    if (prm[i] * 2 > n) a1 -= tmp - 1, tmp--;
  long long a2 = 0;
  for (int i = 2; i <= n; i++) cnt[p0[i]]++;
  for (int i = 2; i <= n; i++) cnt[i] += cnt[i - 1];
  for (int i = 1; i <= tot; i++)
    if (1ll * prm[i] * prm[i] > n && prm[i] * 2 <= n)
      a2 += cnt[prm[i] - 1] - cnt[n / prm[i]];
  ans += a2 * 3 + (a1 - a2) * 2;
  printf("%lld\n", ans);
  return 0;
}
