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;
bool flag[10000010];
int pri[10000010], phi[10000010], mu[10000010], tot, n, u[10000010];
long long ans, s[10000010], cnt, tmp;
inline void pre() {
  phi[1] = mu[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (flag[i] == 0) phi[i] = i - 1, mu[i] = -1, pri[++tot] = i, u[i] = i;
    for (int j = 1; i * pri[j] <= n && j <= tot; j++) {
      flag[i * pri[j]] = 1;
      u[i * pri[j]] = pri[j];
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = phi[i] * pri[j];
        mu[i * pri[j]] = 0;
        break;
      } else
        phi[i * pri[j]] = phi[i] * phi[pri[j]], mu[i * pri[j]] = -mu[i];
    }
    s[u[i]]++;
  }
}
inline int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  cin >> n;
  pre();
  for (int i = 2; i <= n; i++) ans += i - 1 - phi[i];
  for (int i = 1; i <= n; i++)
    if (i == u[i] && i * 2 > n) cnt++;
  ans += 3 * (1ll * (n - 1) * (n - 2) / 2 - ans - cnt * (n - 1 - cnt) -
              cnt * (cnt - 1) / 2);
  for (int i = 2; i <= n; i++) s[i] += s[i - 1];
  for (int i = 2; i <= n; i++) tmp += 1ll * (s[i] - s[i - 1]) * s[n / i];
  for (int i = 2; i <= n; i++)
    tmp += 1ll * mu[i] *
           (1ll * (n / i) * (n / i) - (u[i] == i && 1ll * i * i > n));
  cout << ans - tmp / 2 << endl;
  return 0;
}