#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 1; i < n - 1; i++) {
    if (v[i] == 0 && v[i - 1] == 1 && v[i + 1] == 1) {
      v[i + 1] = 0;
      c++;
    }
  }
  cout << c;
}
