#include <cstdio>
#include <unordered_map>
#define lint long long
#define MAX 500003
lint phi[MAX];
std::unordered_map<int, lint> mp;
lint S(int x) {
int i, j;
if (x < MAX) return phi[x];
if (mp.find(x) != mp.end()) return mp[x];
lint ret = x * (x + 1LL) / 2;
for (i = 2; i <= x; i = j+1) {
j = x / (x / i);
ret -= (j - i + 1) * S(x / i);
}
return mp[x] = ret;
}
int main()
{
int N, i, j;
scanf("%d", &N);
for (i = 1; i < MAX; ++i) {
phi[i] += i;
for (j = 2; j*i < MAX; ++j) phi[j*i] -= phi[i];
phi[i] += phi[i-1];
}
printf("%lld", S(N));
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPHVub3JkZXJlZF9tYXA+CiNkZWZpbmUgbGludCBsb25nIGxvbmcKI2RlZmluZSBNQVggNTAwMDAzCgpsaW50IHBoaVtNQVhdOwpzdGQ6OnVub3JkZXJlZF9tYXA8aW50LCBsaW50PiBtcDsKCmxpbnQgUyhpbnQgeCkgewoJaW50IGksIGo7CglpZiAoeCA8IE1BWCkgcmV0dXJuIHBoaVt4XTsKCWlmIChtcC5maW5kKHgpICE9IG1wLmVuZCgpKSByZXR1cm4gbXBbeF07CglsaW50IHJldCA9IHggKiAoeCArIDFMTCkgLyAyOwoJZm9yIChpID0gMjsgaSA8PSB4OyBpID0gaisxKSB7CgkJaiA9IHggLyAoeCAvIGkpOwoJCXJldCAtPSAoaiAtIGkgKyAxKSAqIFMoeCAvIGkpOwoJfQoJcmV0dXJuIG1wW3hdID0gcmV0Owp9CgppbnQgbWFpbigpCnsKCWludCBOLCBpLCBqOwoJc2NhbmYoIiVkIiwgJk4pOwoKCWZvciAoaSA9IDE7IGkgPCBNQVg7ICsraSkgewoJCXBoaVtpXSArPSBpOwoJCWZvciAoaiA9IDI7IGoqaSA8IE1BWDsgKytqKSBwaGlbaippXSAtPSBwaGlbaV07CgkJcGhpW2ldICs9IHBoaVtpLTFdOwoJfQoKCXByaW50ZigiJWxsZCIsIFMoTikpOwoJcmV0dXJuIDA7Cn0=