#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
string s;
ll n,i,d=0;
cin>>n;
ll t=0;
vector<ll> a(n+1),f(2,0);
for(i=1;i<=n;i++)
{
cin>>s;
a[i]=s[s.size()-1]-'0';
}
f[0]=1;
for(i=1;i<=n;i++)
{
t+=a[i];
t%=2;
d+=f[t];
f[t]++;
}
cout<<d;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBmYXN0ZXIgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTtjaW4udGllKDApO2NvdXQudGllKDApOwojZGVmaW5lIGxsIGxvbmcgbG9uZwp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpCnsKICAgIGZhc3RlcgogICAgc3RyaW5nIHM7CiAgICBsbCBuLGksZD0wOwogICAgY2luPj5uOwogICAgbGwgdD0wOwogICAgdmVjdG9yPGxsPiBhKG4rMSksZigyLDApOwogICAgZm9yKGk9MTtpPD1uO2krKykKICAgIHsKICAgICAgICBjaW4+PnM7CiAgICAgICAgYVtpXT1zW3Muc2l6ZSgpLTFdLScwJzsKICAgIH0KICAgIGZbMF09MTsKICAgIGZvcihpPTE7aTw9bjtpKyspCiAgICB7CiAgICAgICAgdCs9YVtpXTsKICAgICAgICB0JT0yOwogICAgICAgIGQrPWZbdF07CiAgICAgICAgZlt0XSsrOwogICAgfQogICAgY291dDw8ZDsKCXJldHVybiAwOwp9