Program gt; var n,i,j,min,max,l,h:integer; a:array[1..1000]of integer; begin readln(n); l:=1;h:=1; max:=-maxint; min:=maxint; for i:=1 to n do begin read(a[i]); if(a[i]>max)then begin l:=i; max:=a[i]; end; if(a[i]<min)then begin h:=i; min:=a[i]; end; end; for i:=1 to n do if(((i>h)and(i<l))or((i<h)and(i>l)))and(a[i]>10)and(a[i]<50)then write(0,' ') else write(a[i],' '); end.
var n,i,j,min,max,l,h:integer;
a:array[1..1000]of integer;
begin
readln(n);
l:=1;h:=1;
max:=-maxint; min:=maxint;
for i:=1 to n do
begin
read(a[i]);
if(a[i]>max)then begin
l:=i; max:=a[i];
end;
if(a[i]<min)then begin
h:=i; min:=a[i];
end;
end;
for i:=1 to n do
if(((i>h)and(i<l))or((i<h)and(i>l)))and(a[i]>10)and(a[i]<50)then
write(0,' ') else write(a[i],' ');
end.