#include <bits/stdc++.h>
using namespace std;

int n;
int a[10002], pr[10002];
long long ans;

int main () {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);

cin >> n;
pr[0]=0;

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

for (int i=1; i <= n; i++) {
    for (int j=i; j <= n; j++) {
        if (pr[j] - pr[i-1] > 0) {ans++;}
    }
}

cout << ans << endl;

return 0;
}
