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;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int NN = 10000005;
int lp[NN], pref[NN], isp[NN], phi[NN];
void pre(int N) {
  N++;
  for (int i = 2; i < N; i++) {
    if (isp[i] == 0) {
      lp[i] = i;
      pref[i]++;
      for (int j = 2 * i; j < N; j += i) {
        if (isp[j] == 0) {
          isp[j] = 1;
          lp[j] = i;
          pref[i]++;
        }
      }
    }
  }
  for (int i = 1; i < N; i++) pref[i] += pref[i - 1];
  phi[1] = 1;
  for (int i = 2; i < N; i++) {
    int j = i / lp[i];
    if (lp[j] == lp[i])
      phi[i] = phi[j] * lp[i];
    else
      phi[i] = (lp[i] - 1) * phi[j];
  }
}
int main() {
  long long int n;
  cin >> n;
  if (n == 1) {
    cout << "0\n";
    return 0;
  }
  pre(n);
  long long int total = n * (n - 1);
  total /= 2;
  long long int cnt = 1;
  for (int i = n / 2 + 1; i <= n; i++) {
    if (isp[i] == 0) cnt++;
  }
  long long int cnt0 = (cnt * (cnt - 1)) / 2;
  cnt0 += (cnt * (n - cnt));
  long long int cnt12 = 0;
  for (int i = 2; i <= n; i++) {
    int j = lp[i];
    int k = n / j;
    cnt12 += (pref[k]);
    if (k >= j) {
      cnt12--;
    }
  }
  cnt12 /= 2;
  long long int cnt1 = 0;
  for (int i = 2; i <= n; i++) {
    cnt1 += (i - 1 - phi[i]);
  }
  __f("total, cnt0, cnt12, cnt1", total, cnt0, cnt12, cnt1);
  long long int cnt2 = cnt12 - cnt1;
  long long int cnt3 = total - cnt0 - cnt12;
  long long int fans = cnt1;
  fans += (2 * cnt2);
  fans += (3 * cnt3);
  cout << fans << "\n";
  return 0;
}