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;
const int MX = 10000005;
int n, cnt = 0;
int phi[MX], lp[MX], om[MX], pref_lp[MX];
bool bad[MX];
int cnt_bad = 0;
void precomp() {
  for (int i = 1; i <= n; i++) phi[i] = i;
  for (int i = 2; i <= n; i++)
    if (!lp[i]) {
      for (int j = i; j <= n; j += i) {
        if (!lp[j]) lp[j] = i;
        phi[j] /= i;
        phi[j] *= (i - 1);
      }
    }
  for (int i = 1; i <= n; i++) {
    if (i == 1 || (lp[i] == i && 2 * i > n)) {
      bad[i] = 1;
      cnt_bad++;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (lp[i] == i)
      om[i] = 1;
    else if (lp[i / lp[i]] == lp[i])
      om[i] = om[i / lp[i]];
    else
      om[i] = om[i / lp[i]] + 1;
  }
}
long long get_dist_one() {
  long long res = 0ll;
  for (int i = 2; i <= n; i++)
    if (!bad[i]) res += i - 1 - phi[i];
  return res;
}
long long get_dist_two() {
  long long res = 0ll;
  int prefprime = 1;
  for (int i = 2; i <= n; i++) {
    if (lp[i] != i)
      res += phi[i] + om[i] - prefprime;
    else
      prefprime++;
  }
  for (int i = 1; i <= n; i++)
    if (!bad[i]) pref_lp[lp[i]]++;
  for (int i = 1; i <= n; i++) pref_lp[i] += pref_lp[i - 1];
  for (int i = 2; i <= n; i++) {
    if (lp[i] != i || bad[i]) continue;
    res += pref_lp[n / i];
    for (int j = i; j <= n; j += i)
      if (lp[j] <= n / i) res--;
  }
  for (int i = 2; i <= n; i++) {
    int a = lp[i], b = i / a;
    if (b != 1 && lp[b] == b && a != b) res--;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  precomp();
  long long cnt_all = (n - cnt_bad) * 1ll * (n - cnt_bad - 1) / 2ll;
  long long cnt_one = get_dist_one();
  long long cnt_two = get_dist_two();
  long long cnt_three = cnt_all - cnt_one - cnt_two;
  printf("%lld\n",
         cnt_one + cnt_two + cnt_two + cnt_three + cnt_three + cnt_three);
  return 0;
}