#include<bits/stdc++.h>
using namespace std;
const int N = 10000;
int arr[N];
int n;
long long res;
vector<int> even;
int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
        if(arr[i] % 2 == 0)
        {
            even.push_back(i);
        }
    }
    for(int i = 0; i < even.size(); i++)
    {
        int left = even[i];
        int right = n - even[i] - 1;
        res += (left + 1) * (right + 1);
    }
    cout << res;
    return 0;
}
