
#include <iostream>
using namespace std;

int main()
{
    //optimizaciq: vsichko koeto umnojish po chetno stava chetno


    int n;
    cin >> n;

    int arr[n];
    for(int i =0; i<n;i++)
        cin >> arr[i];

    int res = 0,
        last=0,curr,
        after,before;

    for(int i = 0;i<n;i++)
    {
        if(arr[i]%2==0)
        {
            curr=i;
            if(last==0)
            {
                before = curr-last+1;
                after = n-curr;
            }
            else
            {
                before = curr-last;
                after = n-last;
            }
            res+=before*after;
            last=curr;
        }
    }
    cout << res<<endl;

    return 0;
}