#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  int n, m = 0, l = 0, y = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 1; j < n - 1; j++) {
    if (a[j - 1] == 1 && a[j + 1] == 1 && a[j] == 0) {
      v.push_back(j);
    }
  }
  if (v.size() == 0)
    cout << 0;
  else {
    int x = 0;
    while (x < v.size()) {
      if (x == v.size() - 1 || v.at(x + 1) - v.at(x) == 2) {
        x = x + 2;
        y = y + 1;
      } else {
        x = x + 1;
        y = y + 1;
      }
    }
    cout << y;
  }
}
