#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 1 && a[i + 1] == 0 && a[i + 2] == 1) {
      if (a[i + 3] == 0 && a[i + 4] == 1) {
        a[i + 2] = 0;
        i += 3;
        count++;
      } else {
        a[i] = 0;
        i += 1;
        count++;
      }
    }
  }
  cout << count;
  return 0;
}
