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