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;
inline int read() {
  int num = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) f = c == '-' ? -1 : f, c = getchar();
  while (isdigit(c)) num = (num << 1) + (num << 3) + (c ^ 48), c = getchar();
  return num * f;
}
inline void open_file() {
  freopen("Venus.in", "r", stdin);
  freopen("Venus.out", "w", stdout);
}
const int N = 1e7 + 5;
int primes[N / 10], idx, phi[N], pcnt[N], mp[N], mpcnt[N], t[N], idx2;
inline void Prime(int n) {
  phi[1] = mp[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!mpcnt[i]) {
      primes[++idx] = i;
      phi[i] = i - 1;
      mp[i] = i;
      mpcnt[i] = 1;
      if (i <= (n >> 1)) idx2 = idx;
    }
    pcnt[i] = idx;
    for (int j = 1; i * primes[j] <= n; j++) {
      mp[i * primes[j]] = primes[j];
      if (i % primes[j] == 0) {
        phi[i * primes[j]] = phi[i] * primes[j];
        mpcnt[i * primes[j]] = mpcnt[i];
        break;
      }
      phi[i * primes[j]] = phi[i] * (primes[j] - 1);
      mpcnt[i * primes[j]] = mpcnt[i] + 1;
    }
  }
}
int n;
long long ans, ans0, ans1, ans2, ans3, tot;
signed main() {
  n = read();
  Prime(n);
  tot = (long long)(n - 1) * (n - 2) >> 1;
  for (int i = idx2 + 1; i <= idx; i++) ans0 += n - 2 - idx + i;
  for (int i = 2; i <= n; i++) {
    ans1 += i - 1 - phi[i];
    if (mp[i] != i) {
      ans2 += phi[i] - pcnt[i] + mpcnt[i] - 1;
      ans2 += min(idx2, pcnt[n / mp[i]]);
      if ((long long)mp[i] * mp[i] <= n) ans2--;
    }
  }
  long long nowcntdel = 0;
  for (int i = idx2, j = 2; i >= 1; i--) {
    while (j <= n / primes[i]) {
      if (mp[j] < primes[i]) t[mp[j]]++, nowcntdel++;
      j++;
    }
    nowcntdel -= t[primes[i]];
    ans2 -= nowcntdel;
  }
  for (int i = 1; i <= idx2; i++)
    for (int j = 1; j < i && primes[i] * primes[j] <= n; j++) ans2++;
  ans3 = tot - ans0 - ans1 - ans2;
  printf("%lld\n", ans1 + ans2 * 2 + ans3 * 3);
  return 0;
}