#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, c;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  c = 0;
  for (i = 0; i <= n - 3; i++) {
    if (a[i] == 1 && a[i + 1] == 0 && a[i + 2] == 1) {
      a[i + 2] = 0;
      c++;
    }
  }
  cout << c;
}
