#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, i, j = -100, k, *a, cnt = 0, cnt1 = 0;
  cin >> n;
  a = new int[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n - 2; i++) {
    if (a[i] == 1 && a[i + 1] == 0 && a[i + 2] == 1) {
      if (i - j > 2) {
        cnt++;
        j = i;
        cnt1 = 0;
      } else {
        cnt1++;
      }
    }
  }
  cout << cnt;
  return 0;
}
