#include <bits/stdc++.h>
using namespace std;
int n, ans, v[1009], m, c[1009];
vector<int> e;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 2; i <= n; i++) {
    if (v[i] == 0 and v[i - 1] == 1 and v[i + 1] == 1) c[++m] = i + 1;
  }
  ans = m;
  for (int i = 1; i < m; i++) {
    if (c[i] + 2 == c[i + 1]) {
      ans--;
      c[i] = -1e9, c[i + 1] - 1e9;
      i++;
    }
  }
  cout << ans;
}
