#include <cstdio>
#include <unordered_map>
#define lint long long
#define MAX 0
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+CiNkZWZpbmUgbGludCBsb25nIGxvbmcKI2RlZmluZSBNQVggMAoKbGludCBwaGlbTUFYXTsKc3RkOjp1bm9yZGVyZWRfbWFwPGludCwgbGludD4gbXA7CgpsaW50IFMoaW50IHgpIHsKCWludCBpLCBqOwoJaWYgKHggPCBNQVgpIHJldHVybiBwaGlbeF07CglpZiAobXAuZmluZCh4KSAhPSBtcC5lbmQoKSkgcmV0dXJuIG1wW3hdOwoJbGludCByZXQgPSB4ICogKHggKyAxTEwpIC8gMjsKCWZvciAoaSA9IDI7IGkgPD0geDsgaSA9IGorMSkgewoJCWogPSB4IC8gKHggLyBpKTsKCQlyZXQgLT0gKGogLSBpICsgMSkgKiBTKHggLyBpKTsKCX0KCXJldHVybiBtcFt4XSA9IHJldDsKfQoKaW50IG1haW4oKQp7CglpbnQgTiwgaSwgajsKCXNjYW5mKCIlZCIsICZOKTsKCglmb3IgKGkgPSAxOyBpIDwgTUFYOyArK2kpIHsKCQlwaGlbaV0gKz0gaTsKCQlmb3IgKGogPSAyOyBqKmkgPCBNQVg7ICsraikgcGhpW2oqaV0gLT0gcGhpW2ldOwoJCXBoaVtpXSArPSBwaGlbaS0xXTsKCX0KCglwcmludGYoIiVsbGQiLCBTKE4pKTsKCXJldHVybiAwOwp9