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;
class BIT {
 public:
  int size;
  vector<long long> arr;
  BIT(int n) {
    size = n + 5;
    arr.resize(size);
  }
  void add(int i, long long v) {
    for (int x = i + 1; x < size; x += (x & (-x))) arr[x] += v;
  }
  long long sum(int i) {
    i = min(i, size - 2);
    long long res = 0;
    for (int x = i + 1; x > 0; x -= (x & (-x))) res += arr[x];
    return res;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> msoin(n + 1), prod(n + 1, 1), par(n + 1);
  BIT bit(n + 1);
  long long e = n - 1;
  for (int i = 2; i <= n; i++) {
    if (msoin[i]) continue;
    if (i * 2 > n) e--;
    for (int j = 1; j * i <= n; j++) {
      if (msoin[i * j] == 0) {
        msoin[i * j] = i;
        if (i <= n / 2) bit.add(i, 1);
      }
      prod[i * j] *= i;
      par[i * j]++;
    }
  }
  e = e * (e - 1) / 2;
  long long res = 0;
  for (int i = 2; i <= n; i++) {
    if (prod[i] != i) continue;
    long long co = n / i;
    long long v = co * (co - 1) / 2;
    if (par[i] & 1)
      res += v;
    else
      res -= v;
  }
  e -= res;
  long long v = 0;
  for (int i = 2; i <= n / 2; i++) {
    if (msoin[i] != i) continue;
    long long le = bit.sum(i) - bit.sum(i - 1);
    long long ri = bit.sum(n) - bit.sum(n / i);
    if (i > (n / i)) ri -= le;
    v += le * ri;
  }
  v /= 2;
  e -= v;
  res += v * 3;
  res += e * 2;
  cout << res << "\n";
  return 0;
}