#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  set<int> c;
  int n, x = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 2; i < n - 2; i++) {
    if (a[i - 2] == 1 && a[i - 1] == 0 && a[i] == 1 && a[i + 1] == 0 &&
        a[i + 2] == 1) {
      x++;
      a[i] = 2;
    }
  }
  for (int i = 1; i < n - 1; i++) {
    if (a[i - 1] == 1 && a[i] == 0 && a[i + 1] == 1) {
      c.insert(i - 1);
      c.insert(i + 1);
    }
  }
  if (c.size() != 1)
    cout << floor(c.size() / 2.0) + x;
  else
    cout << 1;
  return 0;
}
