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;
using ll = long long;
int n;
int const N = 1e7 + 2;
int small_prime[N];
int with_smaller[N / 10];
vector<int> primes;
ll typ_par[4];
int licznik[N];
int phi[N];
int ldp[N];
void sieve(int mad) {
  int p = 2;
  while (p <= mad) {
    if (small_prime[p] != 0) {
      licznik[p] = licznik[p - 1];
      with_smaller[licznik[small_prime[p]]]++;
      p++;
      continue;
    }
    primes.push_back(p);
    licznik[p] = licznik[p - 1] + 1;
    small_prime[p] = p;
    with_smaller[licznik[small_prime[p]]]++;
    for (ll i = (ll)p * (ll)p; i <= (ll)mad; i += p) {
      if (small_prime[i] == 0) small_prime[i] = p;
    }
    p++;
  }
}
void calc_phi(int mad) {
  phi[1] = 1;
  ldp[1] = 0;
  int p = 2;
  while (p <= mad) {
    ll k = small_prime[p];
    if (p % (k * k) == 0) {
      phi[p] = k * phi[p / k];
      ldp[p] = ldp[p / k];
    } else {
      phi[p] = (k - 1) * phi[p / k];
      ldp[p] = ldp[p / k] + 1;
    }
    typ_par[1] += (p - 1 - phi[p]);
    p++;
  }
}
int main() {
  scanf("%d", &n);
  licznik[1] = 0;
  sieve(n);
  ll pp = 1 + licznik[n] - licznik[n / 2];
  typ_par[0] = pp * (n - 1) - pp * (pp - 1) / 2;
  calc_phi(n);
  ll oj1 = 0, oj2 = 0, oj3 = 0;
  for (int i = 0; i < primes.size(); i++) {
    oj3 += max(licznik[n / primes[i]] - licznik[primes[i]], 0);
  }
  for (int i = 1; i <= licznik[n]; i++) {
    with_smaller[i] += with_smaller[i - 1];
  }
  for (int i = 0; i < primes.size(); i++) {
    oj2 += (ll)with_smaller[licznik[n / primes[i]]];
    for (int t = primes[i]; t <= n; t += primes[i]) {
      if (small_prime[t] <= n / primes[i]) oj2--;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (small_prime[i] == i) continue;
    oj1 += (ll)(phi[i] - licznik[i] + ldp[i] - 1);
  }
  typ_par[2] = oj1 + oj2 - oj3;
  typ_par[3] = (ll)n * ((ll)n - 1) / 2 - (typ_par[0] + typ_par[1] + typ_par[2]);
  printf("%I64d ", typ_par[1] + 2 * typ_par[2] + 3 * typ_par[3]);
  return 0;
}