uses crt;
var a,ln,nn:array[1..20]of integer;
i,n,max,min,dem,dem1:integer;
begin
clrscr;
write('n='); readln(n);
if (1<n) and (n<=20) then
begin
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
min:=a[1];
max:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
dem:=0;
for i:=1 to n do
if max=a[i] then
begin
inc(dem);
ln[dem]:=i;
end;
dem1:=0;
for i:=1 to n do
if min=a[i] then
begin
inc(dem1);
nn[dem1]:=i;
end;
writeln('so lon nhat cua day la: ',max);
write('vi tri cua no la: ');
for i:=1 to dem do
write(ln[i]:4);
writeln;
writeln('so nho nhat cua day la: ',min);
write('vi tri cua no la: ');
for i:=1 to dem1 do
write(nn[i]:4);
end
else writeln('vui long nhap lai');
readln;
end.