#include <iostream>
using namespace std;
int main() {
int n, q, s, a;
cin >> n;
s = 0;
q = 0;
for (int i = 0; i < n; i++) {
cin >> a;
if ((a % 6 == 0) && (a > 0)) {
q++;
s += a;
}
}
cout << q << ' ' << s << endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgaW50IG4sIHEsIHMsIGE7CiAgY2luID4+IG47CiAgcyA9IDA7CiAgcSA9IDA7CiAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgIGNpbiA+PiBhOwogICAgaWYgKChhICUgNiA9PSAwKSAmJiAoYSA+IDApKSB7CiAgICAgIHErKzsKICAgICAgcyArPSBhOwogICAgfQogIH0KICBjb3V0IDw8IHEgPDwgJyAnIDw8IHMgPDwgZW5kbDsKfQ==