#include <bits/stdc++.h>
using namespace std;
int solve() {
  int n;
  cin >> n;
  int a[n], count = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n >= 5) {
    for (int i = 2; i < n - 2; i++) {
      if (a[i - 2] == 1 and a[i - 1] == 0 and a[i] == 1 and a[i + 1] == 0 and
          a[i + 2] == 1) {
        count++;
        a[i] = 0;
      }
    }
  }
  for (int i = 1; i < n - 1; i++) {
    if (a[i - 1] == 1 and a[i] == 0 and a[i + 1] == 1) {
      a[i + 1] = 0;
      count++;
    }
  }
  return count;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  while (test--) {
    cout << solve();
    cout << '\n';
  }
  return 0;
}
