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>
const int MAXN = 10000005;
int N, s[MAXN], minFactor[MAXN], cntPrimeFactor[MAXN];
struct NumberTheory {
  bool isPrime[MAXN];
  int primeCount, primeList[MAXN], phi[MAXN];
  NumberTheory() {
    isPrime[1] = false;
    phi[1] = 0;
    for (int i = 2; i < MAXN; ++i) isPrime[i] = true;
    sift();
  }
  void sift() {
    for (int i = 2; i < MAXN; ++i) {
      if (isPrime[i])
        primeList[primeCount++] = i, phi[i] = i - 1, minFactor[i] = i;
      for (int j = 0; j < primeCount; ++j) {
        if (i * primeList[j] >= MAXN) break;
        isPrime[i * primeList[j]] = false;
        minFactor[i * primeList[j]] = primeList[j];
        if (i % primeList[j] == 0) {
          phi[i * primeList[j]] = phi[i] * primeList[j];
          break;
        } else
          phi[i * primeList[j]] = phi[i] * (primeList[j] - 1);
      }
    }
    for (int i = 2; i < MAXN; ++i) {
      int j = i;
      while (j % minFactor[i] == 0) j /= minFactor[i];
      cntPrimeFactor[i] = cntPrimeFactor[j] + 1;
    }
  }
} numberTheory;
long long solve0() {
  long long ans = 1;
  for (int i = N; i + i > N; --i) ans += numberTheory.isPrime[i];
  return (ans * (ans - 1) >> 1) + ans * (N - ans);
}
long long solve1() {
  long long ans = 0;
  for (int i = 1; i <= N; ++i) ans += i - 1 - numberTheory.phi[i];
  return ans;
}
long long solve2() {
  long long ans = 0, cntPrimeAnd1 = 1;
  for (int i = 2; i <= N; ++i) {
    if (!numberTheory.isPrime[i])
      ans += numberTheory.phi[i] - cntPrimeAnd1 + cntPrimeFactor[i];
    else
      ++cntPrimeAnd1;
  }
  for (int i = 2; i <= N; ++i) ++s[minFactor[i]];
  for (int i = 2; i <= N; ++i) s[i] += s[i - 1];
  long long j = N;
  for (int i = 2; i + i <= N; ++i) {
    if (numberTheory.isPrime[i]) {
      while (i * j > N) --j;
      ans += s[j];
      for (int k = i; k <= N; k += i)
        if (minFactor[k] <= j) --ans;
    }
  }
  j = 1;
  int cntPrime = 0;
  long long t = 0;
  for (long long i = N >> 1; i >= 2; --i) {
    if (numberTheory.isPrime[i]) {
      while (j * i <= N) {
        if (numberTheory.isPrime[j]) ++cntPrime;
        ++j;
      }
      t += cntPrime;
      if (i * i <= N) --t;
    }
  }
  ans -= t >> 1;
  return ans;
}
int main() {
  scanf("%d", &N);
  long long a0 = solve0();
  long long a1 = solve1();
  long long a2 = solve2();
  printf("%I64d\n",
         a1 + (a2 << 1) + (((long long)N * (N - 1) >> 1) - a0 - a1 - a2) * 3);
  return 0;
}