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;
const int MX = 10000002;
int n, bs[MX], phi[MX], mu[MX], cx[MX], cy[MX];
long long res, cop, cn;
bitset<MX> inx, iny;
void pre() {
  for (int i = 0; i < MX; i++) {
    mu[i] = 1;
    phi[i] = i;
  }
  bs[1] = -1;
  phi[1] = 0;
  mu[1] = 1;
  for (long long i = 2; i < MX; i++) {
    if (!bs[i]) {
      for (long long j = i; j < MX; j += i) {
        if (!bs[j]) bs[j] = i;
        mu[j] *= -1;
        phi[j] -= phi[j] / i;
      }
      for (long long j = i * i; j < MX; j += i * i) mu[j] = 0;
    }
  }
}
int d[MX], m;
void del(int cx[], bitset<MX> &inx, int cy[], int x) {
  inx[x] = 0;
  if (x == 1) {
    cn -= cy[1];
    cx[1]--;
    return;
  }
  d[0] = 1, m = 1;
  while (x > 1) {
    int p = bs[x];
    while (x % p == 0) x /= p;
    for (int i = 0; i < m; i++) d[i + m] = d[i] * p;
    m *= 2;
  }
  for (int i = 0; i < m; i++) {
    int y = d[i];
    cn -= mu[y] * cy[y];
    cx[y]--;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  pre();
  cin >> n;
  for (int i = 2, pre = 1; i <= n; i++) {
    if (2 * bs[i] <= n) {
      res += i - 1 - pre;
      res += phi[i] - pre;
      cop += phi[i] - pre;
    } else {
      pre++;
    }
  }
  for (int i = 1; i <= n; i++)
    if (2 * bs[i] <= n) {
      cx[i] = cy[i] = n / i;
      inx[i] = iny[i] = i - 1;
    } else {
      cx[1]--, cy[1]--;
    }
  inx[1] = 1, cy[1]--;
  cn = 2 * cop + cy[1];
  for (int i = 2, pi = n, pj = n; i * i <= n; i++)
    if (bs[i] == i) {
      for (int j = i; j <= n; j += i)
        if (iny[j]) del(cy, iny, cx, j);
      while (i * pi > n) {
        if (inx[pi]) del(cx, inx, cy, pi);
        pi--;
      }
      while (i * pj > n) {
        if (bs[pj] == pj)
          for (int j = pj; j <= n; j += pj)
            if (iny[j]) del(cy, iny, cx, j);
        pj--;
      }
      cop -= cn;
      for (int j = i; j <= n; j += i)
        if (inx[j]) del(cx, inx, cy, j);
    }
  res += cop;
  cout << res << '\n';
  return 0;
}