uses crt;
var a:array[1..50]of int64;
i,n,t,max,min:int64;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
max:=a[1];
min:=a[1];
t:=0;
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
t:=t+a[i];
end;
writeln('Tong la: ',t);
writeln('So lon nhat la: ',max);
write('Vi tri la: ');
for i:=1 to n do
if a[i]=max then write(i:4);
writeln;
writeln('So nho nhat la: ',min);
write('Vi tri la: ');
for i:=1 to n do
if a[i]=min then write(i:4);
readln;
end.