Program gt;
var b:array[1..100]of integer;
r,i,n,q,min,t:integer;
begin
read(N);
q:=0;
for i:=1 to n do
begin
read(b[i]);
if(b[i]>0)then begin
q:=q+1;
if(q=1)then begin
r:=i;
t:=b[i];
end;
end;
end;
min:=b[1];
for i:=2 to n do
if(b[i]for i:=1 to n do
begin
if(b[i]=min)then b[i]:=t;
if(i=r)then b[i]:=min;
write(b[i],' ');
end;
end.