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 MN = 10000010;
vector<int> pr;
int pchk[MN];
void sieve() {
  for (int i = 2; i < MN; i++) {
    if (!pchk[i]) {
      pr.push_back(i);
      pchk[i] = i;
    }
    for (int j = 0; j < pr.size() && i * pr[j] < MN; j++) {
      pchk[i * pr[j]] = pr[j];
      if (i % pr[j] == 0) break;
    }
  }
}
int N;
long long dp[MN], ans;
int C[MN];
int main() {
  sieve();
  cin >> N;
  for (int i = N; i >= 1; i--) {
    dp[i] = 1LL * (N / i) * (N / i);
    for (int j = 2; i * j <= N; j++) {
      dp[i] -= dp[i * j];
    }
  }
  ans += (1LL * N * (N - 1) / 2) - dp[1] / 2;
  ans += dp[1] / 2 * 3;
  int cnt = 0;
  for (int i = 0; i < pr.size(); i++) {
    if (pr[i] > N) break;
    if (pr[i] > N / 2) cnt++;
  }
  ans -= 3LL * (N - 2) * cnt - 3LL * cnt * (cnt - 1) / 2;
  ans -= 3 * (N - 1);
  for (int i = 2; i <= N; i++) {
    if (pchk[i]) C[pchk[i]]++;
  }
  long long x = 0;
  for (int i = 0; i < pr.size(); i++) {
    for (int j = i; j < pr.size(); j++) {
      if (1LL * pr[i] * pr[j] > N) break;
      if (i == j)
        x += 1LL * C[pr[i]] * (C[pr[i]] - 1) / 2;
      else
        x += 1LL * C[pr[i]] * C[pr[j]];
    }
  }
  ans -= x - (1LL * N * (N - 1) / 2 - dp[1] / 2);
  printf("%lld", ans);
}