uses crt;
var a:array[1..100]of integer;
i,n,t,max,kq,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=0;
for i:=1 to n do
begin
t:=0;
for j:=1 to a[i] do
if a[i] mod j=0 then t:=t+j;
if max<=t then
begin
max:=t;
kq:=a[i];
end;
end;
writeln('So co tong cac uoc lon nhat trong day la: ',kq);
readln;
end.