#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
vector<char> used;
int main() {
  long long n;
  cin >> n;
  int c = 0;
  int *a = new int[n];
  for (size_t i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (size_t i = 1; i < n - 1; i++) {
    if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1) {
      ++ans;
      a[i + 1] = 0;
    }
  }
  cout << ans;
  return 0;
}
