#include <bits/stdc++.h>
using namespace std;
class BDisturbedPeople {
 public:
  void solve(std::istream &in, std::ostream &out) {
    int n;
    in >> n;
    int seq[n];
    for (int i = 0; i < n; ++i) in >> seq[i];
    int ans = 0;
    for (int i = 1; i + 1 < n; ++i) {
      if (seq[i] == 0 && seq[i - 1] == 1 && seq[i + 1] == 1) {
        seq[i + 1] = 0;
        ans++;
      }
    }
    out << ans << '\n';
  }
};
int main() {
  BDisturbedPeople solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
