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;
const int maxn = 10000000 + 7;
const int mod = 1000000000 + 7;
const int invt = 50000007;
int minp[maxn];
int pri[maxn];
int tot;
int mu[maxn];
int phi[maxn];
int n;
long long cnt[maxn];
void init() {
  mu[1] = 1;
  for (int i = 2; i < maxn; i++) {
    if (!minp[i]) {
      minp[i] = i;
      pri[tot++] = i;
      mu[i] = -1;
      phi[i] = i - 1;
    }
    for (int j = 0; j < tot && i * pri[j] < maxn; j++) {
      minp[i * pri[j]] = pri[j];
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = phi[i] * pri[j];
        break;
      } else {
        mu[i * pri[j]] = -mu[i];
        phi[i * pri[j]] = phi[i] * (pri[j] - 1);
      }
    }
  }
}
int main() {
  init();
  cin >> n;
  int haf = n >> 1;
  int all = 0;
  for (int i = 2; i <= n; i++)
    if (minp[i] != i || i <= haf) all++;
  for (int i = 2; i <= n; i++) cnt[minp[i]]++;
  for (int i = 2; i <= n; i++) cnt[i] = cnt[i] + cnt[i - 1];
  long long sum = 1ll * (all - 1) * all / 2, res = 0;
  for (int i = 2; i <= n; i++) {
    if (minp[i] != i || i <= haf) res = res + 1ll * (i - 1 - phi[i]);
  }
  sum -= res;
  long long ta = 0;
  for (int x = 2; x <= n; x++) {
    if (minp[x] != x || x <= haf) ta += cnt[n / minp[x]];
  }
  for (int d = 2, sqt = sqrt(n); d <= n; d++) {
    long long ts = 1ll * (n / d) * (n / d);
    if (minp[d] == d && d > sqt) ts = ts - 1;
    ta = ta + 1ll * ts * mu[d];
  }
  res = res + ta;
  sum = sum - 1ll * (ta >> 1);
  res = res + sum * 3;
  cout << res << endl;
  return 0;
}