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>
const char nl = '\n';
using namespace std;
using ll = long long;
using ld = long double;
const int N = 1e7 + 2;
vector<int> ps;
int pdiv[N];
int pcnt[N];
int divcnt[N];
int totp[N];
int phi[N], mu[N];
void pre(int n) {
  iota(pdiv, pdiv + n + 1, 0);
  mu[1] = phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (pdiv[i] == i) {
      ps.push_back(i);
      mu[i] = -1;
      phi[i] = i - 1;
      totp[i]++;
      for (int j = i; j <= n; j += i) {
        divcnt[j]++;
      }
    }
    for (int ip, j = 0; j < ps.size() && (ip = i * ps[j]) <= n; j++) {
      pdiv[ip] = ps[j];
      if (i % ps[j] == 0) {
        mu[ip] = 0;
        phi[ip] = phi[i] * ps[j];
        break;
      } else {
        mu[ip] = -mu[i];
        phi[ip] = phi[i] * phi[ps[j]];
      }
    }
  }
  for (int i = 2; i <= n; i++) {
    pcnt[pdiv[i]]++;
  }
  for (int i = 2; i <= n; i++) {
    pcnt[i] += pcnt[i - 1];
  }
  for (int i = 2; i <= n; i++) {
    totp[i] += totp[i - 1];
  }
}
ll cnt[4];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  cin >> n;
  pre(n);
  ll bad = 1;
  for (int i = n / 2 + 1; i <= n; i++) {
    bad += (i > 1 && pdiv[i] == i);
  }
  cnt[0] = bad * (n - bad) + bad * (bad - 1) / 2;
  ll coprime = 0;
  for (int d = 1; d <= n; d++) {
    coprime += (ll)mu[d] * (n / d) * (n / d);
  }
  coprime -= 1;
  coprime /= 2;
  cnt[1] = n * (n - 1) / 2 - coprime;
  int pnum = 0;
  for (int i = 1; i <= n; i++) {
    if (pdiv[i] == i) {
      pnum++;
      continue;
    }
    cnt[2] += phi[i] - (pnum - divcnt[i]);
  }
  for (int i = 2; i <= n; i++) {
    if (i != pdiv[i]) continue;
    cnt[2] += pcnt[n / i];
    for (int j = i; j <= n; j += i) {
      cnt[2] -= (pdiv[j] <= n / i);
    }
    cnt[2] -= totp[min((ll)i - 1, n / i)];
  }
  cnt[3] = n * (n - 1) / 2 - cnt[0] - cnt[1] - cnt[2];
  ll ans = 0;
  for (int i = 0; i < 4; i++) {
    ans += i * cnt[i];
  }
  cout << ans << nl;
}