var
	i, j, k, n: longint;
	a, b, p: array [1..500] of longint;
begin
	randseed := 29034877;

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

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

	writeln(n);
	for i := 1 to n do begin
		k := 0;
		for j := 1 to n do begin
			if (a[j] < p[i]) then begin
				inc(k);
				b[k] := a[j];
			end else if (a[j] > p[i]) then begin
				inc(k);
				b[k] := a[j] - 1;
			end;
		end;
		for j := 1 to n - 1 do begin
			write(b[j]);
			if (j < n - 1) then
				write(' ');
		end;               
		writeln;
	end;
end.