// 100 пъти аз по тебе

#include <iostream>
#include <algorithm>
#define int long long
using namespace std;
const int maxn = 1e5+10;

int a[maxn], n;

void solve() {

    int ans = n*(n+1)/2, last_even = 0, diff;
    for (int i = 1 ; i <= n ; ++i) {

        if (a[i] % 2 == 0) {

            diff = i - last_even - 1;
            ans -= diff*(diff+1)/2;
            last_even = i;

        }

    }

    diff = n+1 - last_even - 1;
    ans -= diff*(diff+1)/2;

    cout << ans << '\n';

}

void read() {

    cin >> n;
    for (int i = 1 ; i <= n ; ++i)
        cin >> a[i];

}

void fast_io() {

    ios_base :: sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);

}

signed main () {

    fast_io();
    read();
    solve();

    return 0;

}
