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 N = 10001000;
int sieve[N];
int non_composite_pfx[N];
int smallest_prime_pfx[N];
vector<int> primes;
int pcount[N];
int totient[N];
int n;
void setup() {
  for (int i = 2; i <= n; ++i) {
    totient[i] = i;
  }
  for (int i = 2; i <= n; ++i) {
    if (!sieve[i]) {
      primes.push_back(i);
      for (int j = i; j < N; j += i) {
        if (!sieve[j]) sieve[j] = i;
        ++pcount[j];
        totient[j] /= i;
        totient[j] *= i - 1;
      }
    }
  }
  non_composite_pfx[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (i > n / 2 && sieve[i] == i) continue;
    smallest_prime_pfx[sieve[i]]++;
  }
  for (int i = 2; i <= n; ++i) {
    non_composite_pfx[i] = non_composite_pfx[i - 1] + (sieve[i] == i);
  }
  for (int i = 2; i <= n; ++i) {
    smallest_prime_pfx[i] += smallest_prime_pfx[i - 1];
  }
}
long long type1;
long long type2;
long long bad;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  setup();
  bad = 1;
  for (int i = (n + 2) / 2; i <= n; ++i) {
    if (sieve[i] == i) {
      ++bad;
    }
  }
  for (int i = 2; i <= n; ++i) {
    type1 += i - 1 - totient[i];
  }
  for (int i = 2; i <= n; ++i) {
    if (sieve[i] == i) continue;
    type2 += totient[i] + pcount[i] - non_composite_pfx[i];
  }
  for (int i = 2; i <= n; ++i) {
    if (sieve[i] != i) continue;
    type2 += smallest_prime_pfx[n / i];
    for (int j = i; j <= n; j += i) {
      if (sieve[j] <= n / i) {
        --type2;
      }
    }
  }
  int j = primes.size() - 1;
  for (int i = 0; i < primes.size() && i <= j; ++i) {
    while (j >= 0 &&
           ((long long)primes[i] * primes[j] > n || primes[j] > n / 2)) {
      --j;
    }
    if (j < 0 || i > j) break;
    type2 -= j - i;
  }
  long long badcount = bad * (n - bad) + bad * (bad - 1) / 2;
  long long type3 = (long long)n * (n - 1) / 2 - type1 - type2 - badcount;
  cout << type1 + 2 * type2 + 3 * type3 << "\n";
  return 0;
}