#include <iostream>
using namespace std;
int euler_f (int n) {
int result = n;
for (int i = 2; i * i <= n; ++i) {
if (n % i == 0) {
while (n % i == 0) n /= i;
result -= result / i;
}
}
if (n > 1) result -= result / n;
return result;
}
int main() {
int n;
cin >> n;
int sum = 0;
for (int i = 2; i <= n; ++i) {
sum += euler_f(i);
}
cout << sum;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBldWxlcl9mIChpbnQgbikgeyAKCWludCByZXN1bHQgPSBuOwoJZm9yIChpbnQgaSA9IDI7IGkgKiBpIDw9IG47ICsraSkgewoJCWlmIChuICUgaSA9PSAwKSB7CgkJCXdoaWxlIChuICUgaSA9PSAwKSBuIC89IGk7IAoJCQlyZXN1bHQgLT0gcmVzdWx0IC8gaTsgCgkJfSAKCX0KCWlmIChuID4gMSkgcmVzdWx0IC09IHJlc3VsdCAvIG47IAoJcmV0dXJuIHJlc3VsdDsKfQoKaW50IG1haW4oKSB7CglpbnQgbjsKCWNpbiA+PiBuOwoJaW50IHN1bSA9IDA7Cglmb3IgKGludCBpID0gMjsgaSA8PSBuOyArK2kpIHsKCQlzdW0gKz0gZXVsZXJfZihpKTsKCX0KCWNvdXQgPDwgc3VtOwoJcmV0dXJuIDA7Cn0=