#include <bits/stdc++.h>
using namespace std;
class Solution {
  vector<int> A;
  int n;

 public:
  void run(istream &in, ostream &out) {
    in >> n;
    int ans = 0;
    A.resize(n);
    for (int i = 0; i < n; ++i) in >> A[i];
    for (int i = 1; i < n - 1; ++i) {
      if (A[i] == 0 and A[i - 1] and A[i + 1]) A[i + 1] = 0, ++ans;
    }
    out << ans << '\n';
  }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  Solution().run(cin, cout);
}
