#include <bits/stdc++.h>
using namespace std;
int T,n,S,dem;
int a[1001];
int s[1001];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> T;
while(T--)
{
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
s[1] = a[1];
for(int i = 2; i <= n; i++) s[i] = s[i-1] + a[i];
for(int i = 1; i <= n; i++)
{
for(int j = i; j <= n; j++)
{
S = s[j] - s[i-1];
if(S%2 == 0) dem++;
}
}
cout << dem << endl;
dem = 0;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgVCxuLFMsZGVtOwppbnQgYVsxMDAxXTsKaW50IHNbMTAwMV07CmludCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKE5VTEwpOwogICAgY2luID4+IFQ7CiAgICB3aGlsZShULS0pCiAgICB7CiAgICAgICAgY2luID4+IG47CiAgICAgICAgZm9yKGludCBpID0gMTsgaSA8PSBuOyBpKyspIGNpbiA+PiBhW2ldOwogICAgICAgIHNbMV0gPSBhWzFdOwogICAgICAgIGZvcihpbnQgaSA9IDI7IGkgPD0gbjsgaSsrKSBzW2ldID0gc1tpLTFdICsgYVtpXTsKICAgICAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47IGkrKykKICAgICAgICB7CiAgICAgICAgICAgIGZvcihpbnQgaiA9IGk7IGogPD0gbjsgaisrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBTID0gc1tqXSAtIHNbaS0xXTsKICAgICAgICAgICAgICAgIGlmKFMlMiA9PSAwKSBkZW0rKzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb3V0IDw8IGRlbSA8PCBlbmRsOwogICAgICAgIGRlbSA9IDA7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==