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