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