#include <iostream>
using namespace std;
int solve(int arr[], int n)
{
int count = 0;
for(int i =0 ; i < n;i++)
{
if((arr[i]/2)%2 == 0 || arr[i]%2 ==1) count++;
long long int mul = arr[i];
for(int j = i+1; j<n ; j++)
{
mul = (mul*arr[j])%20;
// cout << mul << " ";
if((mul/2)%2 == 0 || mul%2 == 1) count++;
}
}
return count;
}
int main() {
// your code goes
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
int arr[n];
for(int i =0;i < n;i++)
cin >> arr[i];
cout << solve(arr,n) << "\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKCmludCBzb2x2ZShpbnQgYXJyW10sIGludCBuKQp7CiAgICBpbnQgY291bnQgPSAwOwogICAgZm9yKGludCBpID0wIDsgaSA8IG47aSsrKQogICAgewogICAgICAgIAogICAgICAgIGlmKChhcnJbaV0vMiklMiA9PSAwIHx8IGFycltpXSUyID09MSkgY291bnQrKzsKICAgICAgICBsb25nIGxvbmcgaW50IG11bCA9IGFycltpXTsKICAgICAgICBmb3IoaW50IGogPSBpKzE7IGo8biA7IGorKykKICAgICAgICB7CiAgICAgICAgICAgIG11bCA9IChtdWwqYXJyW2pdKSUyMDsKICAgICAgICAgICAgLy8gY291dCA8PCBtdWwgPDwgIiAiOwogICAgICAgICAgICBpZigobXVsLzIpJTIgPT0gMCB8fCBtdWwlMiA9PSAxKSBjb3VudCsrOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiBjb3VudDsKfQppbnQgbWFpbigpIHsKCS8vIHlvdXIgY29kZSBnb2VzIAoJaW50IHQ7CgljaW4gPj4gdDsKCXdoaWxlKHQtLSkKCXsKCSAgICBpbnQgbjsKCSAgICBjaW4gPj4gbjsKCSAgICBpbnQgYXJyW25dOwoJICAgIGZvcihpbnQgaSA9MDtpIDwgbjtpKyspCgkgICAgICAgIGNpbiA+PiBhcnJbaV07CgkgICAgICAgIAoJICAgIGNvdXQgPDwgc29sdmUoYXJyLG4pIDw8ICJcbiI7ICAgIAoJfQoJCglyZXR1cm4gMDsKfQ==