program hotrotinhoc ;
var a : array[1..32000] of integer ;
i,n : integer ;
function kt (n : integer) : boolean ;
var i,tam: integer ;
begin
kt:= false ; tam:=0;
for i:= 1 to (n div 2) do
if n mod i=0 then tam:=tam+i;
if tam = n then kt:=true ;
end;
begin
write('Day so co so so hang la :'); readln(n);
writeln('Nhap gia tri cua moi phan tu');
for i:= 1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
write('Cac so hoan hao trong day so la :');
for i:= 1 to n do
if kt(a[i]) then write(a[i]);
readln
end.