#include <bits/stdc++.h>
int main() {
  short int input[200000];
  int step;
  int count = 0;
  scanf("%d", &step);
  for (int i = 0; i < step; i++) {
    scanf("%d", &input[i]);
  }
  int min = step - 10000;
  for (int i = 0; i < step; i += 2) {
    int check = 0;
    int en;
    if (i < min)
      en = i + 10000;
    else
      en = step;
    for (int j = i; j < en; j++) {
      check += input[i];
      if (check == 0) count++;
    }
  }
  printf("%d", count);
  return 0;
}
