uses crt;
var a:array[1..100] of integer;
n,i,j,m,k,t:integer;
begin
clrscr;
write('Nhap n:');readln(n);
for i:=1 to n do
begin
write('a[',i,']:');
readln(a[i]);
if i=1 then begin m:=a[1];t:=1;end else if a[i]>m then begin m:=a[i];t:=i;end;
end;
if t=1 then
begin
j := a[2];
for i := 2 to n do if a[i]>j then j:=a[i];
end else
begin
j := a[1];
for i:=1 to n do
if (a[i]>j) and (a[i]<m) then j:=a[i];
end;
for i := 1 to n do if a[i]=j then inc(k);
writeln('So lon thu nhi la:',j);
if k>1 then
begin
write('Cac vi tri cua so do la:');
for i := 1 to n do if a[i]=j then write(i,#32);
end;
readln
end.