#include <bits/stdc++.h>
using namespace std;
int leastPrime[10000001], d[10000001];
long long s[10000001], c[10000001];
int main() {
  int n;
  long long ans1, ans2, ans;
  cin >> n;
  ans1 = 0;
  for (int i = n; i > 1; --i) {
    long long cx = 0;
    for (int j = 2 * i; j <= n; j += i) cx += c[j];
    c[i] = 1ll * (n / i) * (n / i - 1) / 2 - cx;
    ans1 += c[i];
  }
  for (int i = 2; i <= n; ++i) {
    if (leastPrime[i] == 0) {
      int k = 0;
      for (int j = i; j <= n; j += i) {
        if (leastPrime[j] == 0) {
          ++k;
          leastPrime[j] = i;
        }
      }
      d[i] = k;
    }
    s[i] = s[i - 1] + d[i];
  }
  ans2 = 0;
  for (int i = 2; i <= n; ++i) {
    if (d[i]) {
      ans2 += d[i] * s[n / i];
      if (1ll * i * i <= n) ans2 -= d[i];
    }
  }
  ans2 /= 2;
  long long ans3 = s[n / 2] * (s[n / 2] - 1) / 2;
  ans3 -= ans2;
  ans2 -= ans1;
  ans = ans1 + 2 * ans2 + 3 * ans3;
  cout << ans << '\n';
  return 0;
}
