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