uses crt;
var a:array[1..50]of integer;
i,n,t,t1:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (0<n) and (n<=50);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]<=100;
end;
t:=0;
t1:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then t:=t+a[i]
else t1:=t1+a[i];
end;
writeln('Tong cac so chan la: ',t);
writeln('Tong cac so le la: ',t1);
readln;
end.