#include<bits/stdc++.h>
using namespace std;
long long n,a[10001],ans=0;
vector<long long> chetni;
int main(){
    cin>>n;
    for(long long i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2==0) chetni.push_back(i);
    }
    chetni.push_back(-1);
    long long ind=0;
    for(long long i=0;i<n;i++){
        if(i>chetni[ind] && chetni[ind+1]!=-1) ind++;
        if(i<=chetni[ind]){
            ans+=n-chetni[ind];
        }
    }
    cout<<ans<<"\n";
    return 0;
}

