#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, x;
  cin >> n;
  int c = 0;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  for (int i = 1; i < n - 1; i++) {
    if (v[i - 1] == 1 && v[i + 1] == 1 && v[i] == 0) {
      v[i + 1] = 0;
      c++;
    }
  }
  cout << c << "\n";
}
int main() {
  solve();
  return 0;
}
