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>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 1e7 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ = 225;
const long double EPS = 1e-7;
int n;
int phi[N];
int prime[N];
bitset<N> bad;
int cnt[N];
ll cntBad;
void init() {
  for (int i = 1; i < n + 1; i++) phi[i] = i;
  for (int i = 2; i < n + 1; i++) {
    if (prime[i]) continue;
    for (int j = i; j <= n; j += i) {
      if (!prime[j]) prime[j] = i;
      phi[j] /= i;
      phi[j] *= i - 1;
    }
  }
  for (int i = 1; i < n + 1; i++) {
    if (i == 1 || prime[i] == i && i + i > n) {
      bad.set(i);
      cntBad++;
    }
  }
  for (int i = 2; i < n + 1; i++) {
    if (prime[i] == i)
      cnt[i] = 1;
    else
      cnt[i] = cnt[i / prime[i]] + (prime[i / prime[i]] != prime[i]);
  }
}
ll solveOne() {
  ll ans = 0;
  for (int i = 2; i < n + 1; i++)
    if (!bad[i]) ans += (i - 1) - phi[i];
  return ans;
}
int sum[N];
ll solveTwo() {
  ll ans = 0;
  int cntPrimes = 1;
  for (int i = 2; i < n + 1; i++) {
    if (prime[i] != i) {
      ans += phi[i] - cntPrimes + cnt[i];
      sum[prime[i]]++;
    } else
      cntPrimes++;
  }
  for (int i = 2; i <= n; i++) sum[i] += sum[i - 1];
  vector<int> v;
  for (int i = 1; i <= n; i++)
    if (prime[i] == i && !bad[i]) {
      ans += sum[n / i];
      for (int j = i + i; j <= n; j += i) ans--;
      v.push_back(i);
    }
  for (int i = 0, j = v.size() - 1; i < v.size() && i < j; ++i) {
    while (j > i && 1ll * v[i] * v[j] > n) --j;
    ans += j - i;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  init();
  ll cntZero = cntBad * (n - cntBad) + cntBad * (cntBad - 1) / 2;
  ll cntOne = solveOne();
  ll cntTwo = solveTwo();
  ll cntThree = 1ll * n * (n - 1) / 2 - cntOne - cntTwo - cntZero;
  cout << cntOne * 1 + cntThree * 3 + cntTwo * 2 << '\n';
  return 0;
}