瞧我的!!!var n,t,p,s,i:longint;g:array[1..1000]of integer;
begin
read(n);t:=1;
repeat
while g[t]<n do
begin
g[t]:=g[t]+1;p:=0;
for i:=1 to t-1 do if g[t]=g then p:=1;
if p=1 then continue;
if g[t]=t then continue;
if t=n then begin s:=s+1;for i:=1 to n do write(g,' ');writeln;end
else t:=t+1;
end;
g[t]:=0;t:=t-1;
until t=0;
writeln(s);
end.