uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if (a[i] mod 2=0) and (a[i] mod 3=0) then t:=t+a[i];
writeln('Tong cac so chia het cho 2 va 3 la: ',t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,i,n,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0) t+=x;
}
cout<<t;
return 0;
}