#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int v[n];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  queue<pair<int, int>> minh;
  for (int i = 1; i < n - 1; i++) {
    if (v[i] == 0 && (v[i - 1] == 1 && v[i + 1] == 1))
      minh.push({i - 1, i + 1});
  }
  int c = 0;
  bool flag = false;
  while (!minh.empty()) {
    int ts = minh.front().second;
    minh.pop();
    if (minh.size() == 0) {
      flag = true;
      break;
    }
    int tf = minh.front().first;
    if (ts == tf) {
      c++;
      minh.pop();
    } else
      c++;
  }
  if (flag == true) c++;
  cout << c;
}
