#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
vector<int> vec;
bool flag = false;
int arr[109], x, counter;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> x;
  for (int i = 0; i < x; i++) cin >> arr[i];
  for (int i = 1; i < x - 1; i++) {
    if (arr[i] == 0 && arr[i - 1] == 1 && arr[i + 1] == 1) {
      vec.push_back(i);
      flag = true;
    }
  }
  if (flag) {
    for (int i = 0; i < vec.size() - 1; i++) {
      if (abs(vec[i] - vec[i + 1]) == 2) {
        counter++;
        vec[i] = 9999;
        vec[i + 1] = 9999;
      }
    }
    for (int i = 0; i < vec.size(); i++) {
      if (vec[i] != 9999) counter++;
    }
  }
  cout << counter;
  return 0;
}
