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 <typename 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, 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);
}
template <typename 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 <typename T>
inline void println(T first) {
  print(first), putchar('\n');
}
template <typename T>
inline void printsp(T first) {
  print(first), putchar(' ');
}
template <class T, class T1>
inline void print(T first, T1 second) {
  printsp(first), println(second);
}
template <class T, class T1, class T2>
inline void print(T first, T1 second, T2 z) {
  printsp(first), printsp(second), println(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;
}
int vst[10000100], prime[10000100], pk;
int ct[10000100], sum[10000100];
void pre(int n) {
  for (int i = 2; i <= n; i++) {
    if (vst[i]) continue;
    vst[i] = i;
    prime[pk++] = i;
    if (i > 10000) continue;
    for (int j = i * i; j <= n; j += i) {
      if (!vst[j]) vst[j] = i;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (vst[i] == i && i * 2 > n) continue;
    ct[vst[i]]++;
  }
  for (int i = n; i; i--) sum[i] = sum[i + 1] + ct[i];
}
int p[111], cnt;
int main() {
  int n;
  gn(n);
  pre(n);
  long long one = 0;
  for (int i = 2; i <= n; i++) {
    cnt = 0;
    int m = i;
    while (m > 1) {
      p[cnt] = vst[m];
      while (m % p[cnt] == 0) m /= p[cnt];
      cnt++;
    }
    m = i;
    for (int j = 0; j < cnt; j++) m = m / p[j] * (p[j] - 1);
    one += (i - m - 1);
  }
  long long three = 0;
  for (int i = 2; i <= n; i++)
    if (vst[i] == i) {
      int b = n / i + 1;
      smax(b, i + 1);
      three += (long long)ct[i] * sum[b];
    }
  long long two = (long long)sum[1] * (sum[1] - 1) / 2 - one - three;
  println(one + two * 2 + three * 3);
  return 0;
}