#include <bits/stdc++.h>
#define endl '\n'

int n, a[10001];
std::vector<int> even;
long long ans;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    even.push_back(-1);
    std::cin >> n;
    for (int i = 0; i < n; ++ i) {
        std::cin >> a[i];
        if (a[i] % 2 == 0) {
            even.push_back(i);
        }
    }
    for (size_t i = 1; i < even.size(); ++ i) {
        ans += (even[i] - even[i - 1]) * (n - even[i]);
    }
    std::cout << ans << endl;
    return 0;
}
