#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) a[i] = 1 - a[i];
  int cnt = 0;
  for (int i = 1; i + 1 < n; ++i) {
    if (a[i - 1] == 0 && a[i] == 1 && a[i + 1] == 0) {
      ++cnt;
      a[i + 1] = 1;
    }
  }
  cout << cnt << endl;
  return 0;
}
