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