#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[2000], n, m, j, k, i, T;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  int sum = 0;
  for (i = 2; i <= n - 1; i++) {
    if (a[i] == 0) {
      if (a[i - 1] == 1 && a[i + 1] == 1) {
        a[i + 1] = 0;
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
