#pragma GCC optimize("Ofast")
#pragma GCC optimize("O2")
#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
using namespace std;
int main()
{
faster
ll n,i,d=0,t=0;
cin>>n;
vector<ll> a(n+1),f(2,0);
for(i=1;i<=n;i++) cin>>a[i];
f[0]=1;
for(i=1;i<=n;i++)
{
t+=a[i];
t%=2;
d+=f[t];
f[t]++;
}
cout<<d;
return 0;
}
I3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk9mYXN0IikKI3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk8yIikKI2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBmYXN0ZXIgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTtjaW4udGllKDApO2NvdXQudGllKDApOwojZGVmaW5lIGxsIGxvbmcgbG9uZwp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpCnsKICAgIGZhc3RlcgogICAgbGwgbixpLGQ9MCx0PTA7CiAgICBjaW4+Pm47CiAgICB2ZWN0b3I8bGw+IGEobisxKSxmKDIsMCk7CiAgICBmb3IoaT0xO2k8PW47aSsrKSBjaW4+PmFbaV07CiAgICBmWzBdPTE7CiAgICBmb3IoaT0xO2k8PW47aSsrKQogICAgewogICAgICAgIHQrPWFbaV07CiAgICAgICAgdCU9MjsKICAgICAgICBkKz1mW3RdOwogICAgICAgIGZbdF0rKzsKICAgIH0KICAgIGNvdXQ8PGQ7CglyZXR1cm4gMDsKfQ==