#include <bits/stdc++.h>
int main() {
  int n, i, a[100], count = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 2; i < n; i++) {
    if (a[i - 2] == 1 && a[i - 1] == 0 && a[i] == 1) {
      i += 2;
      count++;
    }
  }
  printf("%d", count);
  return 0;
}
