#include <iostream>
#include <vector>

std::vector <int> v;

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

int gaus(int n, int a)
{
    int ans = 0;
    for (int i = 0; i < a; ++i)
    {
        ans+=(n - i);
    }
    return ans;
}

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 - brNechetniPrediChetnoObshto[brChetni];
            brNechetniPrediChetnoObshto[brChetni + 1] = brNechetni;
            brChetni++;
        }
        else
        {
            brNechetni++;
        }
    }
    ans+=gaus(n, brChetni);
    //std::cout<<ans<<'\n';
    for (int i = 1; i <= brChetni; ++i)
    {
        //std::cout<<brNechetniPrediChetno[i] * (brNechetni - brNechetniPrediChetnoObshto[i])<<' '<<brNechetniPrediChetno[i]<<' '<<brNechetni<<' '<<brNechetniPrediChetnoObshto[i]<<'\n';
        ans+=brNechetniPrediChetno[i] * (brNechetni - brNechetniPrediChetnoObshto[i]);
    }
    std::cout<<ans<<'\n';


    return 0;
}
