N, i, m, ind, x: integer;
a: array [1..1000] of integer;
begin
readln(n);
for i:= 1 to n do
read(a[i]);
m:=maxint;
for i:= 1 to n do
if (a[i] m:=a[i];
ind:=i;
end;
for i:= 1 to n do
if (a[i]>0) then begin
x:=a[i];
a[i]:=m;
a[ind]:=x;
break;
end;
for i := 1 to n do
write(a[i], ' ');
readln;
end.
Держи