#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
const int N = 1e7 + 50;
const int M = 1e6 + 50;
int phi[N];
bool st[N];
int p[M];
int cnt;
ll sum[N];
void oular(int n) {
phi[1] = 1;
for (int i = 2;i <= n; i++) {
if (!st[i]) {
p[cnt++] = i;
phi[i] = i - 1;
}
for (int j = 0;p[j] <= n / i; j++) {
st[p[j] * i] = true;
if (i % p[j] == 0) {
phi[p[j] * i] = p[j] * phi[i];
break;
}
phi[p[j] * i] = (p[j] - 1) * phi[i];
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n; cin >> n;
oular(n);
ll ans = 0;
for (int i = 1;i <= cnt; i++) {
sum[i] = sum[i - 1] + phi[i];
}
for (int i = 1;i <= cnt; i++) {
ans += 2 * phi[n / p[i]] + 1;
}
cout << ans << '\n';
return 0;
}