#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> A(n);
  for (int &i : A) cin >> i;
  int ans = 0;
  for (int i = 1; i < (n - 1); i++) {
    if (A[i - 1] == A[i + 1] && A[i - 1] == 1 && A[i] == 0) {
      A[i + 1] = 0;
      ans++;
    }
  }
  cout << ans << endl;
}
