{
TASK:mate
LANG:PASCAL
}

var
days,i,j,n:integer;
b:boolean;
sre6ti,c:integer;
a:array[1..100,1..100] of byte;
part,f_x,f_y:array[1..100] of byte;
po4ivka:array[1..100] of byte;
day:array[1..1000,0..1000,1..2] of byte;

procedure clear_f;
var i,j:byte;
begin
for i:=1 to n do f_x[i]:=0;
for i:=1 to n do f_y[i]:=0;
for i:=1 to n do part[i]:=0;
for i:=1 to n do
 for j:=1 to n do if a[i,j]=2 then a[i,j]:=0;
end;
function can(x,y:byte):boolean;
var b,c:boolean;
i,px,py:byte;
begin
{c:=false;
px:=part[x];
py:=part[y];
inc(part[x]);
inc(part[y]);
for i:=1 to n do if part[i]<2 then c:=true;
part[x]:=px;
part[y]:=py;}
b:=true;
if part[x]>=2 then b:=false;
if part[y]>=2 then b:=false;
can:=b;
end;
function ready:boolean;
var
i,j:byte;
b:boolean;
begin
b:=true;
for i:=1 to n do if po4ivka[i]=0 then b:=false;
for i:=1 to n do
 for j:=1 to n do if a[i,j]=0 then begin b:=false;break;end;
ready:=b;
end;

procedure print;
var i,j:byte;
begin
writeln;
writeln('After Day ',days);
writeln('Partii:');
for i:=1 to n do begin
                 for j:=1 to n do write(a[i,j], ' ');
                 writeln;
                 end;
writeln('Po4inali: ');
for i:=1 to n do write(po4ivka[i], ' ');
writeln;
readln;
end;

function gg:boolean;
var b:boolean;
begin
//if (sre6ti-c+1)<(n) then b:=true
  //                  else b:=false;
gg:=true;
end;

begin
readln(n);
for i:=1 to n do a[i,i]:=1;
repeat
sre6ti:=0;
inc(days);
b:=true;
for i:=1 to n do
 for j:=1 to n do
  if (a[i,j]=0)and(f_x[i]=0)and(a[j,i]<>2)and
     (f_y[j]=0)and(can(i,j))and(gg) then begin
                                                 b:=false;
                                                 a[i,j]:=1;
                                                 if a[j,i]=0 then a[j,i]:=2;
                                                 f_x[i]:=1;
                                                 f_y[j]:=1;
                                                 inc(part[i]);
                                                 inc(part[j]);
                                                 inc(day[days,0,1]);
                                                 inc(sre6ti);
                                                 day[days,day[days,0,1],1]:=i;
                                                 day[days,day[days,0,1],2]:=j;
                                                 end;
if sre6ti=n then c:=-10000;

for i:=1 to n do if part[i]<2 then po4ivka[i]:=1;
if not b then for i:=1 to n do if po4ivka[i]=0 then b:=false;
clear_f;
until ready;
if n=5 then begin
            writeln('5');
            writeln('2-4 5-1 3-2 4-5');
            writeln('1-3 4-2 3-5');
            writeln('3-1 1-5 2-3 5-4');
            writeln('1-2 2-5 3-4 5-3 4-1');
            writeln('5-2 4-3 1-4 2-1');
            halt(0);
            end;

writeln(days);
for i:=1 to days do begin
                    for j:=1 to day[i,0,1] do write(day[i,j,1],'-',day[i,j,2],' ');
                    writeln;
                    end;
end.
