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;
template <typename T1, typename T2>
void chkmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
void chkmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
namespace fastio {
char rbuf[1 << 23], *p1 = rbuf, *p2 = rbuf, wbuf[1 << 23], *p3 = wbuf;
inline char getc() {
  return p1 == p2 &&
                 (p2 = (p1 = rbuf) + fread(rbuf, 1, 1 << 23, stdin), p1 == p2)
             ? -1
             : *p1++;
}
inline void putc(char x) { (*p3++ = x); }
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  T neg = 0;
  while (!isdigit(c)) neg |= !(c ^ '-'), c = getchar();
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (neg) x = (~x) + 1;
}
template <typename T>
void recursive_print(T x) {
  if (!x) return;
  recursive_print(x / 10);
  putc(x % 10 ^ 48);
}
template <typename T>
void print(T x) {
  if (!x) putc('0');
  if (x < 0) putc('-'), x = ~x + 1;
  recursive_print(x);
}
template <typename T>
void print(T x, char c) {
  if (!x) putc('0');
  if (x < 0) putc('-'), x = ~x + 1;
  recursive_print(x);
  putc(c);
}
void print_final() { fwrite(wbuf, 1, p3 - wbuf, stdout); }
}  // namespace fastio
const int MAXN = 1e7;
int n, pr[MAXN / 10 + 5], prcnt = 0, mnp[MAXN + 5], phi[MAXN + 5],
                          cnt[MAXN + 5];
bitset<MAXN + 5> vis;
void sieve() {
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!vis.test(i)) {
      pr[++prcnt] = i;
      phi[i] = i - 1;
      mnp[i] = i;
    }
    for (int j = 1; pr[j] * i <= n && j <= prcnt; j++) {
      vis[pr[j] * i] = 1;
      mnp[pr[j] * i] = pr[j];
      if (i % pr[j] == 0) {
        phi[pr[j] * i] = phi[i] * pr[j];
        break;
      } else
        phi[pr[j] * i] = phi[i] * phi[pr[j]];
    }
  }
}
int calc(int l, int r) { return (l > r) ? 0 : (cnt[r] - cnt[l]); }
int main() {
  scanf("%d", &n);
  sieve();
  long long sum = 0, ans0 = 0, ans1 = 0, ans2 = 0, ans3 = 0;
  for (int i = 2; i <= n; i++) cnt[mnp[i]]++;
  for (int i = 1; i <= n; i++) cnt[i] += cnt[i - 1];
  for (int i = 1; i <= n; i++) sum += phi[i] - 1;
  ans1 = 1ll * (n - 1) * (n - 2) / 2 - sum;
  for (int i = 1; i <= n; i++) {
    int num = cnt[i] - cnt[i - 1];
    if (i <= n / 2) ans3 += 1ll * num * calc(max(i, n / i), n / 2);
    ans0 += 1ll * num * calc(max(n / 2, i), n);
  }
  ans2 = sum - ans0 - ans3;
  printf("%lld\n", ans1 + (ans2 << 1) + (ans3 << 1) + ans3);
  return 0;
}