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>
int n, cnt, good, prime[10000001 / 10], non[10000001], mn[10000001],
    phi[10000001], pref_smallest_prime[10000001];
bool bad[10000001];
void pre() {
  good = n - 1;
  bad[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!mn[i]) {
      if (i + i > n) bad[i] = 1, --good;
      prime[++cnt] = i;
      phi[i] = i - 1;
      mn[i] = i;
    }
    for (int j = 1, k; j <= cnt && (k = i * prime[j]) <= n; ++j) {
      if (!mn[k]) mn[k] = prime[j];
      if (i % prime[j]) {
        phi[k] = phi[i] * phi[prime[j]];
      } else {
        phi[k] = phi[i] * prime[j];
        break;
      }
    }
  }
  for (int i = 2; i <= n; ++i)
    if (mn[i] == i)
      non[i] = 1;
    else if (mn[i / mn[i]] == mn[i])
      non[i] = non[i / mn[i]];
    else
      non[i] = non[i / mn[i]] + 1;
}
long long get1() {
  long long res = 0;
  for (int i = 1; i <= n; ++i)
    if (!bad[i]) res += i - 1 - phi[i];
  return res;
}
long long get2() {
  long long res = 0;
  for (int i = 2, j = 1; i <= n; ++i)
    if (mn[i] == i)
      ++j;
    else
      res += phi[i] - j + non[i];
  for (int i = 1; i <= n; ++i) {
    if (!bad[i]) {
      ++pref_smallest_prime[mn[i]];
    }
  }
  for (int i = 1; i <= n; ++i) {
    pref_smallest_prime[i] += pref_smallest_prime[i - 1];
  }
  for (int i = 2; i <= n; ++i) {
    if (mn[i] != i || bad[i]) continue;
    res += pref_smallest_prime[n / i];
    for (int j = i; j <= n; j += i) {
      if (mn[j] <= n / i) {
        --res;
      }
    }
  }
  for (int i = 2; i <= n; ++i) {
    int a = mn[i];
    int b = i / a;
    if (b != 1 && mn[b] == b && a != b) {
      --res;
    }
  }
  return res;
}
long long calc() {
  pre();
  long long cnt1 = get1();
  long long cnt2 = get2();
  long long cnt3 = good * (good - 1ll) / 2 - cnt1 - cnt2;
  return cnt1 + cnt2 * 2 + cnt3 * 3;
}
int main() {
  scanf("%d", &n);
  printf("%I64d\n", calc());
}