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 kMaxN = 1e7 + 5;
int N;
int phi[kMaxN];
long long prime[kMaxN], primeList[kMaxN], count[kMaxN];
int k = 0;
void ComputePhi() {
  for (int i = 1; i <= N; i++) {
    phi[i] = i;
  }
  for (int i = 2; i <= N; i++) {
    if (phi[i] == i) {
      for (int j = i; j <= N; j += i) {
        phi[j] = phi[j] / i * (i - 1);
      }
    }
  }
}
void ComputePrimes() {
  for (int i = 2; i <= N; i++) {
    if (prime[i] != 0) {
      count[prime[i]]++;
      continue;
    }
    for (int j = i; j <= N; j += i) {
      if (!prime[j]) {
        prime[j] = i;
      }
    }
    count[prime[i]]++;
  }
  for (int i = 2; i <= N; i++) {
    while (count[i] > 0) {
      primeList[++k] = i;
      count[i]--;
    }
  }
}
int main() {
  scanf("%d", &N);
  ComputePhi();
  ComputePrimes();
  long long sol = 0;
  for (int i = 2; i <= N; i++) {
    sol += i - 1 - phi[i];
  }
  sol *= -1;
  int cursor = k;
  for (int i = 1; i <= k; i++) {
    while (cursor >= i && primeList[i] * primeList[cursor] > N) {
      cursor--;
    }
    if (cursor >= i) {
      sol += 2LL * (cursor - i);
    }
  }
  cursor = k;
  for (int i = 1; i <= k; i++) {
    while (cursor > 0 && primeList[i] * primeList[cursor] > N) {
      cursor--;
    }
    cursor++;
    if (2 * primeList[i] <= N && cursor < i &&
        primeList[i] * primeList[cursor] > N) {
      sol += 3LL * (i - cursor);
    }
  }
  printf("%lld\n", sol);
  return 0;
}