var
n,i,j:shortint;
a:array[1..100] of shortint;
begin
assign(input,'coinn.in');
assign(output,'coinn.out');
reset(input);
rewrite(output);
//while not(eof) do
//begin
readln(n);
writeln(n);
fillchar(a,sizeof(a),0);
for i:=1 to n do
begin
for j:=1 to n do
if i=j then
write(abs(a[j]))
else
begin
a[j]:=not(a[j]);
write(abs(a[j]));
end;
writeln;
end;
//end;
close(input);
close(output);
end.