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;
const int oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 200105;
const double PI = acos(-1.0);
const double eps = 1e-6;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
int n, prime[3000105], tot = 0, cnt[3000105], check[10001005], phi[10001005];
long long ans = 0;
void init() {
  for (int i = (2); i <= (n); ++i) {
    if (!check[i])
      prime[++tot] = i, cnt[tot] = 1, ans -= 2 * i > n, phi[i] = i - 1;
    for (int j = 1; (long long)prime[j] * i <= n; j++) {
      check[prime[j] * i] = 1, cnt[j]++;
      if (i % prime[j] == 0) {
        phi[prime[j] * i] = prime[j] * phi[i];
        break;
      }
      phi[prime[j] * i] = (prime[j] - 1) * phi[i];
    }
  }
}
int main() {
  scanf("%d", &n), ans = n - 1;
  init();
  ans = ans * (ans - 1) / 2 * 3 - (long long)n * (n - 1) / 2;
  for (int i = (2); i <= (n); ++i) ans += phi[i];
  for (int i = 1; i <= tot && prime[i] * prime[i] <= n; i++) {
    ans -= (long long)cnt[i] * (cnt[i] - 1) / 2;
    for (int j = i + 1; j <= tot && prime[i] * prime[j] <= n; j++)
      ans -= (long long)cnt[i] * cnt[j];
  }
  printf("%I64d\n", ans);
  return 0;
}