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 MOD = 1e9 + 7;
const int SIZE = 1e7 + 10;
int p[SIZE];
int cnt[SIZE];
vector<int> pp;
long long an;
void prime_init(int n) {
  for (int i = 2; i <= n; i++) {
    if (!p[i]) {
      pp.push_back(i);
      for (int j = i; j <= n; j += i) {
        if (!p[j]) {
          p[j] = i;
          cnt[p[j]]++;
        }
      }
    }
  }
}
bool is_prime(int x) { return p[x] == x; }
long long dp[SIZE];
int main() {
  int(n);
  scanf("%d", &n);
  if (n <= 3) return 0 * puts("0");
  an = (n - 1LL) * (n - 2) * 3;
  prime_init(n);
  {
    long long cc = 0;
    for (int i = 0; i < (((int)(pp).size())); ++i) {
      if (pp[i] * 2 > n) {
        cc++;
      }
    }
    an -= (cc * (cc - 1) + cc * (n - 1 - cc) * 2) * 3;
  }
  for (int i = 0; i < (((int)(pp).size())); ++i) {
    for (int j = 0; j < i && pp[i] * pp[j] <= n; j++) {
      an -= (long long)(cnt[pp[i]]) * cnt[pp[j]] * 2;
    }
    an -= (long long)(cnt[pp[i]] - 1) * cnt[pp[i]];
  }
  for (int i = n; i > 1; i--) {
    dp[i] = (long long)(n / i) * (n / i - 1);
    for (int j = i + i; j <= n; j += i) {
      dp[i] -= dp[j];
    }
    an -= dp[i];
  }
  cout << an / 2 << endl;
  return 0;
}