#include <bits/stdc++.h>
using namespace std;
long long ans, a[100000], n, i, l, j;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 2; i < n; i++) {
    if (a[i - 1] == 1 && a[i] == 0 && a[i + 1] == 1) {
      ans++;
      a[i - 1] = 0;
      a[i + 1] = 0;
    }
  }
  cout << ans;
}
