#include <bits/stdc++.h>
using namespace std;
const int MOD = 1E9 + 7;
const int N = 1E6;
vector<int> even(N, 0);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  if ((s[0] - 48) % 2 == 0) even[0] = 1;
  for (int i = 1; i <= n - 1; i++) {
    int dig = s[i] - 48;
    even[i] = even[i - 1] + (dig % 2 == 0 ? 1 : 0);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int prev = (i == 0 ? 0 : even[i - 1]);
    int add = even[n - 1] - prev;
    cnt += add;
  }
  cout << cnt << endl;
}
