#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ele, res = 0;
  vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ele;
    v.push_back(ele);
  }
  for (int i = 0; i < n - 2; i++) {
    if (v[i] == 1 && v[i + 1] == 0 && v[i + 2] == 1) {
      res++;
      v[i + 2] = 0;
    }
  }
  cout << res << endl;
}
