#include<iostream>
#include<vector>
using namespace std;
int main(){
    long long N,sum=0,a[10000], pr=0,sl=0;
    bool sreshtnato=false;
    cin>>N;
    for(long long i=0;i<N;i++){
        cin>>a[i];
    }
    for(long long i=0;i<N;i++){
        if(sreshtnato==false && a[i]%2!=0){
            pr++;
        }
        if(sreshtnato==true && a[i]%2!=0){
            sl++;
        }
        if(sreshtnato==true && (a[i]%2==0 || i==N-1)){
            sum+=pr+sl+1+pr*sl;
            pr=sl;
            sl=0;
        }
        if(sreshtnato==false && a[i]%2==0){
            sreshtnato=true;
        }
    }
    cout<<sum;
return 0;
}
