#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> ara;
  int i, n, dis = 0, mx = 0, num;
  bool flag = false;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> num;
    ara.push_back(num);
  }
  for (i = 0; i < n; i++) {
    if (ara[i] == 1 && ara[i + 1] == 0 && ara[i + 2] == 1) {
      dis++;
      i = i + 2;
    }
  }
  cout << dis << endl;
  return 0;
}
