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 <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcnt(s);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int back[10000005], so[10000005], have[10000005], prime[10000005];
int n;
long long dem(long long x) { return x * (x - 1) / 2; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  long long all = dem(n - 1), l0 = 0, l1 = 0, l2 = 0, l3 = 0;
  memset(back, 0, sizeof(back));
  memset(so, 0, sizeof(so));
  memset(have, 0, sizeof(have));
  for (long long i = 2; i <= n; i++)
    if (back[i] == 0) {
      back[i] = i;
      for (long long j = i * i; j <= n; j += i)
        if (back[j] == 0) {
          back[j] = i;
        }
    }
  for (long long i = 2; i <= n; i++) {
    if (back[i] == i) {
      so[i] = 1;
    } else {
      int x = i / back[i];
      if (x % back[i] != 0 && so[x] != 0) {
        so[i] = so[x] + 1;
      }
    }
    if (so[i]) {
      long long A = n / i;
      if (so[i] & 1)
        l1 += dem(A);
      else
        l1 -= dem(A);
    }
    if (back[i] == i && i + i > n) l0++;
    if (back[i] != i) have[back[i]]++;
  }
  l0 = dem(l0) + l0 * (n - l0 - 1);
  for (int i = n; i >= 2; i--) have[i] += have[i + 1];
  prime[1] = 0;
  for (int i = 2; i <= n; i++) prime[i] = prime[i - 1] + (back[i] == i);
  for (int i = 2; i <= n; i++)
    if (back[i] == i && i + i <= n) {
      int u = n / i + 1;
      l3 += have[u];
      if (u < i) l3 += prime[i] - 1 - prime[u - 1];
    }
  l2 = all - l0 - l1 - l3;
  long long res = l1 + l2 * 2 + l3 * 3;
  cout << res << endl;
  return 0;
}