#include <iostream>
#include <vector>

std::vector <int> v;

int brNechetniSledChetno[10005];
int brNechetniPrediChetno[10005];
int brNechetniPrediChetnoObshto[10005];

int gaus(int a)
{
    return (a * (a - 1)) / 2;
}

int main()
{
    int n;
    std::cin>>n;
    int brChetni = 0, brNechetni = 0;
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        int a;
        std::cin>>a;
        if (a % 2 == 0)
        {
            brNechetniPrediChetno[brChetni + 1] = brNechetni - brNechetniPrediChetno[brChetni];
            brNechetniPrediChetnoObshto[brChetni + 1] = brNechetniPrediChetnoObshto[brChetni];
            brChetni++;
        }
        else
        {
            brNechetni++;
            brNechetniPrediChetnoObshto[brChetni + 1]++;
        }
    }
    ans+=gaus(brChetni);
    for (int i = 1; i <= brChetni; ++i)
    {
        ans+=brNechetniPrediChetno[i] * (brNechetni - brNechetniPrediChetnoObshto[i]);
    }
    std::cout<<ans<<'\n';


    return 0;
}
