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;
vector<int> primes, min_p;
vector<int> sieve(int n) {
  vector<int> ret;
  vector<bool> is_prime(n + 1);
  min_p.resize(n + 1, -1);
  for (int i = 2; i <= n; i++) is_prime[i] = true;
  for (int i = 2; i <= n; i++) {
    if (is_prime[i]) {
      ret.push_back(i);
      min_p[i] = i;
      for (int j = 2 * i; j <= n; j += i) {
        if (is_prime[j]) min_p[j] = i, is_prime[j] = false;
      }
    }
  }
  return ret;
}
vector<int> list_mebius(int n) {
  vector<int> res(n + 1, 1);
  primes = sieve(n);
  for (int p : primes)
    for (int i = p; i <= n; i += p) {
      if ((i / p) % p) {
        res[i] *= -1;
      } else {
        res[i] = 0;
      }
    }
  return res;
}
int main() {
  int64_t N;
  cin >> N;
  int64_t common = 0;
  auto meb = list_mebius(N);
  for (int i = 2; i <= N; i++) common -= (N / i) * (N / i) * meb[i];
  int64_t no_common = (N - 1) * (N - 1) - common;
  int64_t over = 0;
  for (int p : primes)
    if (2 * p > N) over++;
  int64_t dead = 2 * (N - 1) * over - over * over - over;
  vector<int64_t> A(N + 1);
  for (int i = 2; i <= N; i++) A[min_p[i]]++;
  auto S = A;
  for (int i = 2; i <= N; i++) S[i] += S[i - 1];
  int64_t ex = 0;
  for (int p : primes) {
    ex += A[p] * (S[N] - S[N / p]);
  }
  for (int64_t p : primes)
    if (p * p > N) ex -= A[p] * A[p];
  int64_t d1 = common;
  int64_t d2 = no_common - ex;
  int64_t d3 = ex - dead;
  int64_t ans = d1 + 2 * d2 + 3 * d3;
  ans -= N - 1;
  ans /= 2;
  cout << ans << endl;
  return 0;
}