#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, A[100005], cnt = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> A[i];
  }
  for (i = 2; i <= n - 1; i++) {
    if (A[i] == 0 && A[i - 1] == 1 && A[i + 1] == 1) {
      A[i + 1] = 0;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
