#include <bits/stdc++.h>
using namespace std;
int minLights;
void checkLight(int a[], int i, int n, int lights) {
  if (i == n - 1) {
    minLights = min(minLights, lights);
    return;
  }
  if (a[i] == 0) {
    if (a[i - 1] == 1 && a[i + 1] == 1) {
      a[i + 1] = 0;
      checkLight(a, i + 1, n, lights + 1);
      a[i + 1] = 1;
    } else
      checkLight(a, i + 1, n, lights);
  } else
    checkLight(a, i + 1, n, lights);
}
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  minLights = INT_MAX;
  checkLight(a, 1, n, 0);
  cout << minLights;
  return 0;
}
