#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
long long a[1000000], b[1000000];
long long INF=1000000000;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long n,i,j,br=0;

    cin>>n;

    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    b[n+1]=INF;
    for(i=n;i>=1;i--)
    {
        if(a[i]%2==0)
        {
            b[i]=i;
        }
        else b[i]=b[i+1];
    }

    for(i=1;i<=n;i++)
    {
       if(b[i]!=INF) br+=n-b[i]+1;
    }

    cout<<br<<endl;


}

