#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int np, p[11000000], phi[11000000];
long long cnt[11000000], sum[11000000];
void prepare() {
  for (int i = 1; i < 11000000; i++) phi[i] = i;
  for (int i = 2; i < 11000000; i += 2) phi[i] /= 2;
  for (int i = 3; i < 11000000; i += 2)
    if (phi[i] == i) {
      for (int j = i; j < 11000000; j += i) phi[j] -= phi[j] / i;
    }
  for (int i = 2; i < 11000000; i++) {
    if (p[i]) continue;
    for (int j = i; j < 11000000; j += i) {
      if (p[j] == 0) p[j] = i;
    }
  }
}
int main() {
  prepare();
  int N;
  gn(N);
  long long one = 0;
  for (int i = 2; i <= N; i++) {
    one += i - phi[i] - 1;
  }
  long long three = 0;
  for (int i = 2; i <= N; i++) {
    if (p[i] * 2 > N && p[i] == i) continue;
    cnt[p[i]]++;
  }
  for (int i = N; i > 0; i--) {
    sum[i] = sum[i + 1] + cnt[i];
  }
  for (int i = 2; i <= N; i++) {
    if (p[i] != i) continue;
    int q = N / i + 1;
    q = max(q, i + 1);
    three += sum[q] * cnt[i];
  }
  long long two = sum[1] * (sum[1] - 1) / 2;
  two -= one + three;
  long long ans = one + 2 * two + 3 * three;
  cout << ans << endl;
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int np, p[11000000], phi[11000000];
long long cnt[11000000], sum[11000000];
void prepare() {
  for (int i = 1; i < 11000000; i++) phi[i] = i;
  for (int i = 2; i < 11000000; i += 2) phi[i] /= 2;
  for (int i = 3; i < 11000000; i += 2)
    if (phi[i] == i) {
      for (int j = i; j < 11000000; j += i) phi[j] -= phi[j] / i;
    }
  for (int i = 2; i < 11000000; i++) {
    if (p[i]) continue;
    for (int j = i; j < 11000000; j += i) {
      if (p[j] == 0) p[j] = i;
    }
  }
}
int main() {
  prepare();
  int N;
  gn(N);
  long long one = 0;
  for (int i = 2; i <= N; i++) {
    one += i - phi[i] - 1;
  }
  long long three = 0;
  for (int i = 2; i <= N; i++) {
    if (p[i] * 2 > N && p[i] == i) continue;
    cnt[p[i]]++;
  }
  for (int i = N; i > 0; i--) {
    sum[i] = sum[i + 1] + cnt[i];
  }
  for (int i = 2; i <= N; i++) {
    if (p[i] != i) continue;
    int q = N / i + 1;
    q = max(q, i + 1);
    three += sum[q] * cnt[i];
  }
  long long two = sum[1] * (sum[1] - 1) / 2;
  two -= one + three;
  long long ans = one + 2 * two + 3 * three;
  cout << ans << endl;
  return 0;
}

```