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 pri[10010000], tot = 0;
bool ok[10010000];
int phi[10010000], Min[10010000];
int n;
int s[10010000];
void init() {
  for (int i = 2; i <= n; i++) {
    if (!ok[i]) pri[++tot] = i, phi[i] = i - 1, Min[i] = i;
    for (int j = 1; j <= tot && i * pri[j] <= n; j++) {
      ok[i * pri[j]] = 1;
      Min[i * pri[j]] = pri[j];
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = phi[i] * pri[j];
        break;
      }
      phi[i * pri[j]] = phi[i] * phi[pri[j]];
    }
  }
}
int main() {
  scanf("%d", &n);
  init();
  for (int i = 2; i <= n; i++) s[Min[i]]++;
  for (int i = 2; i <= n; i++) s[i] += s[i - 1];
  long long Ans = 0;
  for (int i = 1; i <= tot; i++) {
    if (pri[i] > n / 2) break;
    int S = s[pri[i]] - s[pri[i] - 1];
    if (n / pri[i] >= pri[i]) {
      Ans = Ans + (s[n / pri[i]] - s[pri[i]]) * 2ll * S;
    }
    int w = std::max(pri[i], n / pri[i]);
    Ans = Ans + (s[n / 2] - s[w]) * 3ll * S;
    int o = 3;
    if (1ll * pri[i] * pri[i] <= n) o = 2;
    Ans = Ans + 1ll * (1 + S) * S / 2 * o;
  }
  for (int i = 2; i <= n; i++) {
    Ans -= (i - 1) - phi[i];
    if (1ll * Min[i] * Min[i] <= n)
      Ans -= 2;
    else if (Min[i] * 2 <= n)
      Ans -= 3;
  }
  printf("%lld\n", Ans);
}