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 T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
inline unsigned int myrand(int n) {
  unsigned int u = rand() % n;
  int c = rand() % 10;
  u ^= u << c;
  u ^= (u << 7) & 263692864;
  u ^= (u << 15) & 402273075;
  u %= n;
  return u;
}
int fir[10000011];
int prim[10000011], cnt[10000011], fai[10000011];
int np;
long long one, two, three, zero;
void pre(int n) {
  cnt[1] = 1;
  prim[np] = 1;
  fai[1] = 1;
  for (register int i = 2, s; i <= n; i++) {
    if (fir[i] == 0) {
      fir[i] = i, prim[++np] = i;
      if ((i << 1) > n) zero++;
    }
    for (register int j = 1, k; j <= np; j++) {
      k = prim[j] * i;
      if (k > n) break;
      if (fir[k] == 0) fir[k] = (prim[j] < fir[i]) ? prim[j] : fir[i];
    }
    if ((fir[i] << 1) <= n) cnt[fir[i]]++;
    if (fir[(s = i / fir[i])] == fir[i])
      fai[i] = fai[s] * fir[i];
    else
      fai[i] = fai[s] * (fir[i] - 1);
    one += i - 1 - fai[i];
  }
}
long long solve(int n) {
  pre(n);
  int tot = 0;
  for (int i = 0, j = np; i <= np; i++) {
    while (j > i and (long long) prim[i] * prim[j] > n) tot += cnt[prim[j--]];
    if (j < i) tot -= cnt[prim[i]];
    three += (long long)cnt[prim[i]] * tot;
  }
  zero = n - zero - 1;
  two = (zero - 1) * zero / 2 - one - three;
  return one + 2 * two + 3 * three;
}
int main() {
  int n;
  cin >> n;
  cout << solve(n) << endl;
  return 0;
}