#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const long long int big = 1e18 + 100;
const long double pai = 3.141592653589793238462643383279502884197;
const long double ena = 2.71828182845904523536;
const long double eps = 1e-7;
template <class T, class U>
void mineq(T& a, U b) {
  if (a > b) {
    a = b;
  }
}
template <class T, class U>
void maxeq(T& a, U b) {
  if (a < b) {
    a = b;
  }
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) {
    return b;
  } else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
vector<int> yaku;
vector<int> hou;
void init(int n) {
  int i, j;
  yaku.resize(n + 1);
  hou.resize(n + 1);
  for (i = 2; i <= n / 2; i++) {
    if (yaku[i] != 0) {
      continue;
    }
    for (j = i; j <= n; j += i) {
      if (yaku[j] == 0) {
        yaku[j] = i;
      }
    }
  }
  int iti[256];
  int count[256];
  int hai[256];
  vector<int> wari;
  count[0] = -1;
  for (int bit = 1; bit < 256; bit++) {
    count[bit] = -count[bit & (bit - 1)];
  }
  for (i = 2; i <= n; i++) {
    int gen = i;
    if (yaku[i] == 0) {
      continue;
    }
    while (gen != 1) {
      if (wari.size() == 0 || yaku[gen] != wari.back()) {
        wari.push_back(yaku[gen]);
      }
      gen /= yaku[gen];
    }
    for (int h = 0; h < wari.size(); h++) {
      hai[1 << h] = wari[h];
    }
    iti[0] = n;
    int ret = 0;
    for (int bit = 1; bit < (1 << wari.size()); bit++) {
      iti[bit] = iti[bit & (bit - 1)] / hai[bit - (bit & (bit - 1))];
      ret += iti[bit] * count[bit];
    }
    hou[i] = ret;
    wari.clear();
  }
}
int main(void) {
  int n, K, i, j;
  cin >> n;
  init(n);
  long long int muri = 0;
  vector<int> imos(n + 1);
  for (i = 2; i <= n; i++) {
    if (yaku[i] == 0) {
      muri++;
      continue;
    }
    imos[yaku[i]]++;
  }
  for (i = 2; i < n; i++) {
    imos[i + 1] += imos[i];
  }
  long long int ans = 0;
  for (i = 2; i <= n; i++) {
    if (yaku[i] == 0) {
      continue;
    }
    long long int one, two, thr = 0;
    one = hou[i];
    two = imos[n / yaku[i]];
    if (n / yaku[i] < yaku[i]) {
      two += imos[yaku[i]] - imos[yaku[i] - 1];
    }
    thr = n - muri;
    ans += one;
    ans += 2 * (two - one);
    ans += 3 * (thr - two);
    ans -= 4;
  }
  cout << ans / 2 << endl;
  return 0;
}

### Prompt

Please formulate a CPP solution to the following 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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const long long int big = 1e18 + 100;
const long double pai = 3.141592653589793238462643383279502884197;
const long double ena = 2.71828182845904523536;
const long double eps = 1e-7;
template <class T, class U>
void mineq(T& a, U b) {
  if (a > b) {
    a = b;
  }
}
template <class T, class U>
void maxeq(T& a, U b) {
  if (a < b) {
    a = b;
  }
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) {
    return b;
  } else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
vector<int> yaku;
vector<int> hou;
void init(int n) {
  int i, j;
  yaku.resize(n + 1);
  hou.resize(n + 1);
  for (i = 2; i <= n / 2; i++) {
    if (yaku[i] != 0) {
      continue;
    }
    for (j = i; j <= n; j += i) {
      if (yaku[j] == 0) {
        yaku[j] = i;
      }
    }
  }
  int iti[256];
  int count[256];
  int hai[256];
  vector<int> wari;
  count[0] = -1;
  for (int bit = 1; bit < 256; bit++) {
    count[bit] = -count[bit & (bit - 1)];
  }
  for (i = 2; i <= n; i++) {
    int gen = i;
    if (yaku[i] == 0) {
      continue;
    }
    while (gen != 1) {
      if (wari.size() == 0 || yaku[gen] != wari.back()) {
        wari.push_back(yaku[gen]);
      }
      gen /= yaku[gen];
    }
    for (int h = 0; h < wari.size(); h++) {
      hai[1 << h] = wari[h];
    }
    iti[0] = n;
    int ret = 0;
    for (int bit = 1; bit < (1 << wari.size()); bit++) {
      iti[bit] = iti[bit & (bit - 1)] / hai[bit - (bit & (bit - 1))];
      ret += iti[bit] * count[bit];
    }
    hou[i] = ret;
    wari.clear();
  }
}
int main(void) {
  int n, K, i, j;
  cin >> n;
  init(n);
  long long int muri = 0;
  vector<int> imos(n + 1);
  for (i = 2; i <= n; i++) {
    if (yaku[i] == 0) {
      muri++;
      continue;
    }
    imos[yaku[i]]++;
  }
  for (i = 2; i < n; i++) {
    imos[i + 1] += imos[i];
  }
  long long int ans = 0;
  for (i = 2; i <= n; i++) {
    if (yaku[i] == 0) {
      continue;
    }
    long long int one, two, thr = 0;
    one = hou[i];
    two = imos[n / yaku[i]];
    if (n / yaku[i] < yaku[i]) {
      two += imos[yaku[i]] - imos[yaku[i] - 1];
    }
    thr = n - muri;
    ans += one;
    ans += 2 * (two - one);
    ans += 3 * (thr - two);
    ans -= 4;
  }
  cout << ans / 2 << endl;
  return 0;
}

```