#include <bits/stdc++.h>
using namespace std;
namespace io {
const int n = 1e6;
char c, b[n], *i, *j;
inline char gc() {
if (i == j) {
j = (i = b) + fread(b, 1, n, stdin);
if (i == j) return EOF;
} return *i ++;
}
#define gc getchar
template <typename T = int>
inline T read() {
T s = 0; int x = 0;
while (!isdigit(c = gc())) x |= c == '-';
for (; isdigit(c); c = gc())
s = (s << 1) + (s << 3) + (c & 15);
return x ? - s : s;
}
}
using io :: read;
const int N = 5;
int phi[N], s[N];
vector<int> p;
void init(int n) {
phi[1] = 1;
for (int i = 2; i <= n; ++ i) {
if (!phi[i]) {
phi[i] = i - 1;
p.emplace_back(i);
}
for (int j : p) {
if (i * j > n) break;
phi[i * j] = phi[i] * (j - (i % j > 0));
if (!(i % j)) break;
}
}
s[1] = 3;
for (int i = 2; i <= n; ++ i)
s[i] = s[i - 1] + phi[i] * 2;
}
signed main() {
int n = read(); init(n);
printf("%d\n", s[n - 1]);
return 0;
}