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