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;
int N;
int fai[10000005], Prime[10000005], Get[10000005], Sum[10000005], Index;
int IsPrime[10000005];
int main() {
  scanf("%d", &N);
  fai[1] = 1;
  for (int i = 2; i <= N; i++) {
    if (!IsPrime[i]) {
      Index++;
      IsPrime[i] = Prime[Index] = i;
      fai[i] = i - 1;
    }
    for (int j = 1; i * Prime[j] <= N && j <= Index; j++) {
      IsPrime[i * Prime[j]] = Prime[j];
      if (i % Prime[j] == 0) {
        fai[i * Prime[j]] = fai[i] * Prime[j];
        break;
      } else
        fai[i * Prime[j]] = fai[i] * (Prime[j] - 1);
    }
  }
  long long Fir = 0;
  for (int i = 2; i <= N; i++) Fir += i - fai[i] - 1;
  for (int i = 2; i <= N; i++) Get[IsPrime[i]]++;
  for (int i = 2; i <= N; i++) Sum[i] = Sum[i - 1] + Get[i];
  long long Sec = 0;
  for (int i = 1; i <= Index; i++)
    Sec += 1ll * Get[Prime[i]] * Sum[N / Prime[i]];
  for (int i = 2; i <= N; i++)
    if (1ll * IsPrime[i] * IsPrime[i] <= N) Sec--;
  Sec = Sec / 2 - Fir;
  long long Try = N - 1, Thi = 0;
  for (int i = 1; i <= Index; i++)
    if (Prime[i] * 2 > N) Try--;
  Thi = 1ll * Try * (Try - 1) / 2 - Fir - Sec;
  cout << Fir + 1ll * 2 * Sec + 1ll * 3 * Thi;
  return 0;
}