#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 5;
int n, a[MAXN], k;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 2; i < n; i++) {
    if (a[i] && (!a[i - 1]) && a[i - 2]) {
      k++;
      a[i] = 0;
    }
  }
  cout << k << endl;
  return 0;
}
