///even.cpp
#include <bits/stdc++.h>
#define ednl "\n"
using namespace std;


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long n,dg=0,ans=0,a;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a%2==0){
            ans=ans+(i-dg+1)*(n-i);
            dg=i+1;
        }
    }
    cout<<ans<<endl;

    return 0;
}


