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>
#pragma GCC target("sse4.2")
using namespace std;
bool home = 1;
signed realMain();
signed main() {
  home = 0;
  if (home) {
    freopen("tony_stark", "r", stdin);
  } else {
    ios::sync_with_stdio(0);
    cin.tie(0);
  }
  realMain();
}
class linearSieve {
 public:
  vector<int> primes;
  vector<int> lp;
  void put(int Limit) {
    primes.clear();
    lp.clear();
    lp.resize(Limit + 1, 0);
    for (int i = 2; i <= Limit; i++) {
      if (!lp[i]) {
        lp[i] = i;
        primes.push_back(i);
      }
      for (int j = 0; j < (int)primes.size() && primes[j] * i <= Limit &&
                      primes[j] <= lp[i];
           j++) {
        lp[primes[j] * i] = primes[j];
      }
    }
  }
} user;
const int N = (int)1e7 + 7;
int n, lp[N], cnt, aib[N];
bool bad[N];
long long ret;
int get_phi(int i) {
  int ret = i;
  while (i > 1) {
    int d = lp[i];
    while (i % d == 0) {
      i /= d;
    }
    ret /= d;
    ret *= (d - 1);
  }
  return ret;
}
void add(int i) {
  while (i <= n) {
    aib[i]++;
    i += i & (-i);
  }
}
int pre(int i) {
  int ret = 0;
  while (i) {
    ret += aib[i];
    i -= i & (-i);
  }
  return ret;
}
signed realMain() {
  cin >> n;
  user.put(n);
  for (int i = 1; i <= n; i++) {
    lp[i] = user.lp[i];
    bad[i] = (i == 1 || (lp[i] == i && 2 * i > n));
  }
  add(1);
  for (int i = 2; i <= n; i++) {
    if (bad[i]) {
      add(lp[i]);
      continue;
    }
    cnt++;
    ret += get_phi(i) + 3 * cnt - i - 1 - pre(n / lp[i]);
    add(lp[i]);
  }
  cout << ret << "\n";
  if (home && n == 999) {
    assert(ret == 679078);
  }
  return 0;
}