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 N = 1e7 + 6;
int n;
int pri[N], ntp[N], low[N], phi[N], pn;
void getpri() {
  phi[1] = 1;
  ntp[1] = 1;
  low[1] = 1;
  for (int i = (2); i < (N); ++i) {
    if (!ntp[i]) pri[pn++] = i, phi[i] = i - 1, low[i] = i;
    for (int j = 0, o; j < pn && (o = pri[j] * i) < N; j++) {
      ntp[o] = 1;
      low[o] = pri[j];
      if (i % pri[j])
        phi[o] = (pri[j] - 1) * phi[i];
      else {
        phi[o] = pri[j] * phi[i];
        break;
      }
    }
  }
}
long long gao_tp1() {
  long long ret = 0, tmp = 1;
  for (int i = (2); i < (n + 1); ++i) {
    if (!ntp[i]) {
      tmp++;
      ret += (n / i) - 1;
    } else
      ret += phi[i] - tmp;
  }
  return ret;
}
int cnt[N];
long long gao_tp2() {
  long long ret = 0, tmp = 0, _tmp = n;
  for (int i = (2); i < (n + 1); ++i)
    if (ntp[i] || i * 2 <= n) cnt[low[i]]++, tmp++;
  for (int i = (2); i < (n + 1); ++i) {
    while (i * _tmp > n) tmp -= cnt[_tmp--];
    if (!ntp[i]) {
      ret += tmp;
      for (int j = i; j <= n; j += i)
        if (1ll * low[j] * i <= n) ret--;
    }
  }
  return ret;
}
long long gao_tp3() {
  long long ret = 0, tmp = 0, _tmp = n;
  for (int i = (2); i < (n + 1); ++i)
    if (!ntp[i]) tmp++;
  for (int i = (2); i < (n + 1); ++i) {
    if (!ntp[i]) tmp--;
    while (_tmp > i && i * _tmp > n) tmp -= !ntp[_tmp--];
    if (_tmp == i) return ret;
    if (!ntp[i]) ret += tmp;
  }
  return ret;
}
int main() {
  getpri();
  scanf("%d", &n);
  long long ans = 0;
  int bad = 1;
  for (int i = (2); i < (n + 1); ++i) {
    if (!ntp[i] && i * 2 > n) {
      bad++;
      continue;
    }
    ans += i - 1 - phi[i] + (phi[i] - bad) * 3;
  }
  long long tp1 = gao_tp1();
  long long tp2 = gao_tp2();
  long long tp3 = gao_tp3();
  printf("%lld", ans - (tp1 + tp2 - tp3));
  return 0;
}