uses crt;
var a:array[1..1000]of integer;
i,n,j,tam,t,t1,tam,dem,max:integer;
begin
clrscr;
n:=0;
t:=0;
repeat
inc(n);
write('A[',n,']='); readln(a[n]);
t:=t+a[n];
until t>100;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
writeln('Day so theo chieu tang dan la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t1:=0;
dem:=0;
for i:=1 to n do
if a[i] mod 3=0 then
begin
t1:=t1+a[i];
inc(dem);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('Tong cac so la boi cua 3 la: ',t1);
writeln('So lon nhat cua day la: ',max);
writeln('So luong so la boi cua 3 la: ',dem);
readln;
end.