#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, s = 0;
  scanf("%d", &n);
  scanf("%d%d", &a, &b);
  n -= 2;
  while (n--) {
    scanf("%d", &c);
    if (a + c == 2 && !b) {
      c = 0;
      s++;
    }
    a = b;
    b = c;
  }
  printf("%d", s);
}
