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, sbad, phi[10000005];
int pri[10000005], di[10000005], pref[10000005];
bool bad[10000005];
void prepare() {
  for (int i = 1; i <= n; i++) phi[i] = i;
  for (int i = 2; i <= n; i++) {
    if (pri[i]) continue;
    for (int j = i; j <= n; j += i) {
      if (!pri[j]) pri[j] = i;
      phi[j] -= phi[j] / i;
    }
  }
  for (int i = 1; i <= n; i++)
    if (i == 1 || (pri[i] == i && 2 * i > n)) bad[i] = 1, sbad++;
  for (int i = 2; i <= n; i++)
    if (pri[i] == i)
      di[i] = 1;
    else if (pri[i / pri[i]] == pri[i])
      di[i] = di[i / pri[i]];
    else
      di[i] = di[i / pri[i]] + 1;
}
long long ask1() {
  long long ans = 0;
  for (int i = 2; i <= n; i++)
    if (!bad[i]) ans += i - 1 - phi[i];
  return ans;
}
long long ask2() {
  long long ans = 0;
  int pre = 1;
  for (int i = 2; i <= n; i++)
    if (pri[i] != i) {
      ans += phi[i];
      ans -= pre;
      ans += di[i];
    } else
      pre++;
  for (int i = 1; i <= n; i++)
    if (!bad[i]) pref[pri[i]]++;
  for (int i = 1; i <= n; i++) pref[i] += pref[i - 1];
  for (int i = 2; i <= n; i++) {
    if (pri[i] != i || bad[i]) continue;
    ans += pref[n / i];
    for (int j = i; j <= n; j += i)
      if (pri[j] <= n / i) --ans;
  }
  for (int i = 2; i <= n; i++) {
    int a = pri[i], b = i / a;
    if (b != 1 && pri[b] == b && a != b) ans--;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  prepare();
  long long ans1 = ask1();
  long long ans2 = ask2();
  long long ans3 = 1ll * (n - sbad) * (n - sbad - 1) / 2 - ans1 - ans2;
  printf("%I64d", ans1 + ans2 * 2 + ans3 * 3);
}