#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  vector<int> a(t);
  int x = 0;
  for (int i = 0; i < t; i++) {
    cin >> a[i];
  }
  int count = 0;
  for (int i = 1; i < t; i++) {
    if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1) {
      count++;
      if (a.size() > 3 && i != 1) {
        if ((i - 1) != x) {
          x = i + 1;
        } else {
          count--;
        }
      } else {
        x = i + 1;
      }
    }
  }
  cout << count;
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
