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>
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double eps = 1e-7;
const int inf = 1000000010;
const long long INF = 10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 10000010, LOG = 20;
long long n, m, k, u, v, x, y, t, c1, c2, c3, ans;
int sieve[MAXN];
int phi[MAXN];
int ps[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  sieve[1] = phi[1] = 1;
  for (int i = 2; i < MAXN; i++)
    if (!sieve[i])
      for (int j = i; j < MAXN; j += i)
        if (!sieve[j]) sieve[j] = i;
  for (int i = 2; i < MAXN; i++) {
    int p = sieve[i], tmp = i / p;
    if (tmp % p)
      phi[i] = (p - 1) * phi[tmp];
    else
      phi[i] = p * phi[tmp];
  }
  cin >> n;
  for (int i = 2; i <= n; i++) {
    c1 += i - phi[i] - 1;
    if (sieve[i] == i && 2 * i > n) t++;
  }
  t = n - t - 1;
  c3 = t * (t - 1) / 2;
  for (int i = 2; i <= n; i++) ps[sieve[i]]++;
  for (int i = 2; i <= n; i++) ps[i] += ps[i - 1];
  for (int i = 2; i <= n; i++) c2 += ps[n / sieve[i]];
  for (int i = 2; i <= n; i++)
    if (1ll * sieve[i] * sieve[i] <= n) c2--;
  c2 /= 2;
  c2 -= c1;
  c3 -= c1 + c2;
  cout << c1 + 2 * c2 + 3 * c3 << '\n';
  return 0;
}