/*#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
    //optimizaciq: vsichko koeto umnojish po chetno stava chetno
    int result = 0;

    int n;
    cin >> n;

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

    int res=1;
    for(int i = 0;i<n;i++)
    {
        res=arr[i];
        if(arr[i]%2==0)
            result++;
        for(int j =i+1; j<n;j++)
        {
            res*=arr[j];
            if(res%2==0)
            {
                result++;
            }
        }
    }
    cout << result<<endl;

    return 0;
}*/






#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;
    int done=0;
    for(int i = 0;i<n;i++)
    {
        if(arr[i]%2==0)
        {
            curr=i;
            if(done==0)
            {
                before = curr-last+1;
                after = n-curr;
                done++;
            }
            else
            {
                before = curr-last;
                after = n-curr;
            }
            res+=before*after;
            last=curr;
        }
    }
    cout << res<<endl;
//7 1 1 1 2 1 1 2
    return 0;
}
