#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  int arr[n];
  int i, j, k, l = 0;
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0, j = i + 1, k = i + 2; k < n; i++, j++, k++) {
    if (arr[i] == 1 && arr[j] == 0 && arr[k] == 1) {
      l++;
      arr[k] = 0;
    }
  }
  cout << l << endl;
  return 0;
}
