Program al;
var x: array[1..32000] of integer;
buf:integer;
i,n,min,max:integer;
begin
writeln('i=');
readln(i);
writeln('vvedite massiv=');
for n := 1 to i do
readln(x[n]);
min:=1;
max:=1;
for n:=2 to i do
begin
if x[min]>x[n] then
min:=n;
if x[max] max:=n;
end;
buf:=x[min];
x[min]:=x[max];
x[max]:=buf;
writeln('Massiv posle obmena max<->min');
for n:=1 to i do
write(x[n]:4);
writeln;
end.