#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, c = 0;
  cin >> t;
  vector<int> vec(t);
  for (int &i : vec) cin >> i;
  for (int i = 1; i < t - 1; i++) {
    if (vec[i] == 0 && vec[i + 1] == 1 && vec[i - 1] == 1) c++, vec[i + 1] = 0;
  }
  cout << c;
  return 0;
}
