#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long s[n];
  for (long long a = 0; a < n; a++) {
    cin >> s[a];
  }
  long long c = 0;
  for (long long a = 1; a < n - 1; a++) {
    if (s[a] == 0 && s[a + 1] == 1 && s[a - 1] == 1) {
      s[a + 1] = 2;
      a = a + 1;
      c++;
    }
  }
  cout << c;
  return 0;
}
