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 runs, p[10001000 >> 3], phi[10001000], mu[10001000], f[10001000];
void ppm(int n) {
  phi[1] = 1, mu[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!phi[i]) p[++runs] = i, phi[i] = i - 1, mu[i] = -1, f[runs] = 1;
    for (int j = 1; j <= runs && i * p[j] <= n; j++) {
      int k = i * p[j];
      f[j]++;
      phi[k] = phi[i] * (p[j] - 1);
      if (i % p[j] == 0) {
        phi[k] = phi[i] * p[j];
        break;
      }
      mu[k] = -mu[i];
    }
  }
}
int n;
long long g[10001000];
long long calc(int n) {
  g[1] = 1;
  for (int i = 2; i <= n; i++) g[i] = g[i - 1] + 2 * phi[i];
  return g[n];
}
int main() {
  scanf("%d", &n);
  ppm(n);
  long long m = calc(n);
  m = (m - 1) / 2;
  long long ans = 1ll * n * (n - 1) / 2 - m;
  m -= n - 1;
  int cnt = 0;
  for (int i = 1; i <= runs; i++)
    if (p[i] * 2 > n && p[i] <= n) cnt++;
  m -= 1ll * cnt * (n - 2) - 1ll * cnt * (cnt - 1) / 2;
  ans += 2 * m;
  while (runs && p[runs] * 2 > n) runs--;
  if (runs) {
    long long sum1 = 0, sum2 = 0;
    for (int i = 1; i <= runs; i++) sum1 += f[i], sum2 += 1ll * f[i] * f[i];
    long long tmp = (sum1 * sum1 - sum2) / 2;
    for (int i = 1; i <= runs; i++) {
      for (int j = 1; j < i && 1ll * p[i] * p[j] <= n; j++)
        tmp -= 1ll * f[i] * f[j];
    }
    ans += tmp;
  }
  printf("%I64d\n", ans);
  return 0;
}