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 MAX_N = 1e7 + 10;
int n, fac[MAX_N], pri[MAX_N], pri_n, fac_cnt[MAX_N], phi[MAX_N];
long long ans;
void init() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    if (!fac[i]) {
      phi[i] = (fac[i] = pri[++pri_n] = i) - 1;
      fac_cnt[i] = 1;
    }
    for (int j = 1; j <= pri_n && pri[j] * i <= n && pri[j] <= fac[i]; j++) {
      fac[pri[j] * i] = pri[j];
      fac_cnt[pri[j] * i] = fac_cnt[i] + (pri[j] == fac[i] ? 0 : 1);
      phi[pri[j] * i] = phi[i] * (pri[j] - (pri[j] == fac[i] ? 0 : 1));
    }
  }
}
long long get_pair_suc() {
  long long suc = 0;
  for (int i = 2; i <= n; i++)
    if (i * 2 <= n || fac[i] != i) suc++;
  return suc * (suc - 1) / 2;
}
long long get_pair_1() {
  long long res = 0;
  for (int i = 2; i <= n; i++) res += i - 1 - phi[i];
  return res;
}
long long get_pair_2() {
  static int pref_fac[MAX_N];
  int pref_pri = 0;
  long long res = 0;
  for (int i = 2; i <= n; i++) {
    if (fac[i] == i)
      pref_pri++;
    else
      res += phi[i] - (pref_pri - fac_cnt[i]) - 1;
  }
  for (int i = 2; i <= n; i++) pref_fac[fac[i]]++;
  for (int i = 2; i <= n; i++) pref_fac[i] += pref_fac[i - 1];
  for (int i = 2; i <= n; i++) {
    if (fac[i] != i) continue;
    int lim = n / fac[i];
    res += pref_fac[lim];
    for (int j = i; j <= n; j += i)
      if (fac[j] <= lim) res--;
  }
  for (int i = 2; i <= n; i++)
    if (fac_cnt[i] == 2 && fac[i / fac[i]] == i / fac[i]) res--;
  return res;
}
void solve() {
  long long pair_suc = get_pair_suc();
  long long pair_1 = get_pair_1();
  long long pair_2 = get_pair_2();
  long long pair_3 = pair_suc - pair_1 - pair_2;
  long long ans = pair_1 * 1 + pair_2 * 2 + pair_3 * 3;
  printf("%lld\n", ans);
}
int main() {
  init();
  solve();
}