#include <bits/stdc++.h>
int main() {
  long int len;
  int numarr[65010];
  long int counter, i, checked;
  counter = 0;
  i = 0;
  scanf("%ld", &len);
  for (i = 0; i < len; i++) {
    scanf("%1d", &numarr[i]);
  }
  i = 0;
  checked = 0;
  for (i = 0; i < len; i++) {
    if (numarr[i] % 2 == 0) {
      checked += 1;
      counter += checked;
      continue;
    }
    checked += 1;
  }
  printf("%ld", counter);
  return 0;
}
