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;
int pv[10000010], phi[10000010], mn[10000010], np;
int cnt[10000010];
void pre() {
  for (int i = 2; i < 10000010; i++) {
    if (!mn[i]) {
      pv[np++] = i;
      mn[i] = i;
    }
    for (int j = 0; j < np && pv[j] * i < 10000010; j++) {
      mn[i * pv[j]] = pv[j];
      if (mn[i] == pv[j]) break;
    }
  }
  for (int i = 1; i < 10000010; i++) phi[i] = i;
  for (int i = 2; i < 10000010; i += 2) phi[i] >>= 1;
  for (int i = 3; i < 10000010; i += 2) {
    if (phi[i] == i) {
      for (int j = i; j < 10000010; j += i) phi[j] -= phi[j] / i;
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pre();
  int n;
  cin >> n;
  long long cnt0 = 1, cnt1 = 0, cnt2 = 0, cnt3 = 0;
  long long tot = 1LL * n * (n - 1) / 2;
  for (int i = 2; i <= n; i++) {
    if (mn[i] == i && mn[i] > n / 2) cnt0++;
  }
  cnt0 = n - cnt0;
  cnt0 = tot - cnt0 * (cnt0 - 1) / 2;
  cnt1 = tot;
  for (int i = 2; i <= n; i++) cnt1 -= phi[i];
  for (int i = 2; i <= n; i++) cnt[mn[i]]++;
  for (int i = n; i >= 2; i--) cnt[i] += cnt[i + 1];
  long long tmp = 0;
  for (int v = 2; v <= n; v++) {
    int x = n / mn[v] + 1;
    tmp += cnt[x];
    if (mn[v] > n / mn[v]) tmp--;
  }
  cnt2 = tot - cnt1 - tmp / 2 - (n - 1);
  cnt3 = tot - cnt0 - cnt1 - cnt2;
  long long ans = cnt1 + 2 * cnt2 + 3 * cnt3;
  cout << ans << endl;
}