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 maxn = 10000010;
int phi[maxn];
int f[maxn];
bool vis[maxn];
int prime[maxn];
int cur = 0;
int cnt[maxn];
int sum[maxn];
int n;
long long num1, num2, num3, num4;
long long ans;
void Linear_shaker() {
  phi[1] = f[1] = 1;
  for (int i = 2; i < maxn; i++) {
    if (!vis[i]) prime[++cur] = i, phi[i] = i - 1, f[i] = i;
    for (int j = 1; j <= cur && i * prime[j] < maxn; j++) {
      int k = i * prime[j];
      f[k] = prime[j];
      vis[k] = true;
      if (i % prime[j])
        phi[k] = phi[i] * phi[prime[j]];
      else {
        phi[k] = phi[i] * prime[j];
        break;
      }
    }
  }
}
int main() {
  Linear_shaker();
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) cnt[f[i]]++;
  for (int i = 2; i <= n; i++) sum[i] = sum[i - 1] + cnt[i];
  num1 = 0;
  for (int i = 2; i <= n; i++)
    num1 += ((long long)cnt[i] * (long long)sum[n / i]);
  int sn = (int)floor(sqrt((double)n) + 1e-4);
  for (int i = 2; i <= sn; i++) num1 -= (long long)cnt[i];
  num2 = 0;
  for (int i = 2; i <= n; i++) num2 += (long long)(i - phi[i] - 1);
  num2 <<= 1;
  num1 -= num2;
  swap(num1, num2);
  num3 = 0;
  for (int i = 2; i <= n; i++) num3 += (long long)(phi[i] - 1);
  num3 <<= 1;
  num3 -= num2;
  num4 = 0;
  for (int i = 1; i <= n; i++)
    if (2 * i > n) num4 += ((long long)cnt[i] * (long long)(n - 2));
  num4 <<= 1;
  int temp = 0;
  for (int i = 1; i <= n; i++)
    if (2 * i > n && !vis[i]) temp++;
  num4 -= ((long long)temp * (long long)(temp - 1));
  num3 -= num4;
  num1 >>= 1;
  num2 >>= 1;
  num3 >>= 1;
  ans = num1 + 2LL * num2 + 3LL * num3;
  printf("%I64d\n", ans);
  return 0;
}