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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand(long long l, long long r) {
  uniform_int_distribution<long long> uid(l, r);
  return uid(rng);
}
const int mod = 1e9 + 7;
int pwr(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * 1LL * a) % mod;
    }
    a = (a * 1LL * a) % mod;
    b >>= 1;
  }
  return ans;
}
const int N = 1e7 + 5;
int smp[N], cnt[N];
bool pr[N];
int phi[N], lol[N];
int zz = 0;
signed main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  iota(phi + 1, phi + n + 1, 1);
  pr[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!pr[i]) {
      for (int j = i; j <= n; j += i) {
        if (!smp[j]) {
          lol[++zz] = i;
          smp[j] = i;
        }
        cnt[j]++;
        pr[j] = 1;
        phi[j] = (i - 1) * (phi[j] / i);
      }
      pr[i] = 0;
    }
  }
  reverse(lol + 1, lol + n);
  int pt = 1;
  long long one = 0, two = 0;
  for (int i = 2; i <= n; i++) {
    if (!pr[i] && i <= n / 2) {
      for (int j = i; j <= n; j += i) {
        if (smp[j] * 1LL * i <= n) two--;
      }
      while (pt < n && lol[pt] * 1LL * i > n) pt++;
      two += n - pt;
    }
  }
  int cp = 1;
  for (int i = 2; i <= n; i++) {
    if (pr[i]) {
      two += phi[i] - cp + cnt[i];
    }
    one += i - 1 - phi[i];
    if (!pr[i]) cp++;
  }
  long long c = 1;
  for (int i = n / 2 + 1; i <= n; i++) {
    if (!pr[i]) c++;
  }
  long long zero = c * (n - 1) - (c * (c - 1)) / 2;
  for (int i = 2; i <= n; i++) {
    if (cnt[i] == 2 && !pr[i / smp[i]]) two--;
  }
  long long three = (n * 1LL * (n - 1)) / 2 - zero - one - two;
  cout << three * 3 + two * 2 + one * 1;
  return 0;
}