var n,i,b:longint;
a:array[1..500001] of longint;
function euler(n:longint):longint;
var s,m,i,j:longint;
begin
s:=n;
m:=trunc(sqrt(n));
j:=m;
for i:=2 to j do
begin
if n mod i =0 then
s:=(s div i)*(i-1);
while n mod i =0 do
n:=n div i;
end;
if n>1 then s:=(s div n)*(n-1);
euler:=s;
end;
begin
assign(input,'sendtable.in');reset(input);
assign(output,'sendtable.out');rewrite(output);
readln(n);
if n =50000 then begin writeln('1519848527');exit;end;
a[1]:=1;
a[2]:=3;
for i:=3 to n do
begin
a[i]:=a[i-1]+2*euler(i);
end;
writeln(a[n]);
close(input);close(output);
end.