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 N = 1e7 + 5;
int n, bads = 0, prime[N], phi[N], number_of_prime_divisors[N], pre_prime[N];
char bad[N];
void calc() {
  for (int i = 1; i <= n; i++) phi[i] = i;
  for (int i = 2; i <= n; i++) {
    if (prime[i]) continue;
    for (int j = i; j <= n; j += i) {
      if (!prime[j]) prime[j] = i;
      phi[j] = phi[j] / i * (i - 1);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i == 1 || prime[i] == i && i * 2 > n) {
      bad[i] = 1;
      bads++;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (prime[i] == i) {
      number_of_prime_divisors[i] = 1;
    } else if (prime[i / prime[i]] == prime[i]) {
      number_of_prime_divisors[i] = number_of_prime_divisors[i / prime[i]];
    } else {
      number_of_prime_divisors[i] = number_of_prime_divisors[i / prime[i]] + 1;
    }
  }
}
long long get_dist1() {
  long long ans = 0;
  for (int i = 2; i <= n; i++) {
    if (!bad[i]) {
      ans += i - 1 - phi[i];
    }
  }
  return ans;
}
long long get_dist2() {
  long long ans = 0;
  int sushu = 1;
  for (int i = 2; i <= n; i++) {
    if (prime[i] != i) {
      ans += phi[i];
      ans -= sushu;
      ans += number_of_prime_divisors[i];
    } else
      ++sushu;
  }
  for (int i = 1; i <= n; i++) {
    if (!bad[i]) ++pre_prime[prime[i]];
  }
  for (int i = 1; i <= n; i++) pre_prime[i] += pre_prime[i - 1];
  for (int i = 2; i <= n; i++) {
    if (prime[i] != i || bad[i]) continue;
    ans += pre_prime[n / i];
    for (int j = i; j <= n; j += i) {
      if (prime[j] <= n / i) --ans;
    }
  }
  for (int i = 2; i <= n; i++) {
    int a = prime[i];
    int b = i / a;
    if (b != 1 && prime[b] == b && a != b) ans--;
  }
  return ans;
}
long long solve(int n) {
  calc();
  long long cnt1 = get_dist1(), cnt2 = get_dist2();
  long long cnt3 = (long long)(n - bads) * (n - bads - 1) / 2 - cnt1 - cnt2;
  return cnt1 * 1 + cnt2 * 2 + cnt3 * 3;
}
int main() {
  cin >> n;
  cout << solve(n) << endl;
  return 0;
}