#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool compare(const pair<int, int>& a, const pair<int, int>& b) {
  return a.second < b.second;
}
bool not_fixed(vector<int>& v) {
  for (int i = 1; i < v.size() - 1; i++) {
    if (v[i] == 0 && v[i - 1] == 1 && v[i + 1] == 1) return true;
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int ans = 0;
  while (not_fixed(v)) {
    map<int, int> wo;
    for (int i = 1; i < n - 1; i++) {
      if (v[i] == 0 && v[i - 1] == 1 && v[i + 1] == 1) {
        wo[i - 1]++;
        wo[i + 1]++;
      }
    }
    int maxi = max_element(wo.begin(), wo.end(), compare)->first;
    v[maxi] = 0;
    ans++;
  }
  cout << ans << endl;
}
