const
	maxn = 100000;
var
	n, k, i, j: longint;
	ch, p, q: array [1..maxn] of longint;
begin
    randseed := 45674620;
	
	n := 100000;
	k := 40;

	for i := 2 to n do begin
		p[i] := (i + n div 2) div (n div 2);
	end;

	for i := 1 to n do begin
		j := random(i) + 1;
		q[i] := q[j];
		q[j] := i;
	end;

	for i := 1 to n do begin
		if q[i] = 1 then begin
			q[i] := q[1];
			q[1] := 1;
		end;
	end;

	writeln(n);
	for i := 2 to n do begin
		writeln(p[q[i]], ' ', q[i]);
	end;
end.