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 = 10000003;
int ppp[MAXN];
int phi[MAXN];
int fen[MAXN];
void upd(int x) {
  for (int s = x; s < MAXN; s += s & -s) fen[s]++;
}
int que(int x) {
  int ans = 0;
  for (int s = x; s > 0; s -= s & -s) ans += fen[s];
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) phi[i] = 1;
  for (int i = 2; i <= n; i++) {
    if (ppp[i] == 0) {
      for (int j = i; j <= n; j += i) {
        if (ppp[j] == 0) ppp[j] = i;
        int k = 1;
        int x = j;
        while (x % i == 0) {
          x /= i;
          k *= i;
        }
        phi[j] *= k - k / i;
      }
    }
  }
  long long ans = 0;
  for (int m = 2; m <= n; m++) {
    if (ppp[m] * 2 > n) continue;
    int nans = 0;
    int tot = m - 2;
    nans += m - phi[m] - 1;
    tot -= m - phi[m] - 1;
    int q = que(n / ppp[m]) - (m - phi[m] - 1);
    tot -= q;
    nans += q * 2;
    tot -= m - 2 - que(n / 2);
    nans += tot * 3;
    upd(ppp[m]);
    ans += nans;
  }
  cout << ans << '\n';
  return 0;
}