program Project1; {$APPTYPE CONSOLE} uses SysUtils; var n,i,j,ans: longint; inp,outp: text; a: array[1..10000000]of longint; b: array[1..20000000]of integer; function NSD(var m,b: longint): longint; label 1; var l,k: integer; c: longint; begin k:=m; l:=b; if k=l then begin NSD:=k; goto 1; end; while (k<>0)and(l<>0)do if k>l then k:=k-l else l:=l-k; if k<>0 then NSD:=k else NSD:=l; 1: end; begin assign(inp,'pair.in'); assign(outp,'pair.out'); reset(inp); rewrite(outp); readln(inp,n); ans:=0; for i:=1 to n do a[i]:=i; for i:=1 to n do for j:=1 to n do if a[i]=a[j]then inc(ans) else if (a[i]=NSD(a[i],a[j]))and(b[i+j]<>1)then begin inc(ans); writeln(outp,i,' ',j); b[i+j]:=1; end; if n=1 then writeln(outp,'1') else writeln(outp,ans); close(inp); close(outp); end.