#include <bits/stdc++.h>
using namespace std;
int a[300000];
int main() {
  int i, j, n, k, m, l = 0, h, b = 0, c;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 1; i < n - 1; i++) {
    if (a[i - 1] == 1 && a[i + 1] == 1 && a[i] == 0) {
      l++;
      a[i + 1] = 0;
    }
  }
  cout << l << endl;
  return 0;
}
