#include <bits/stdc++.h>
using namespace std;
long long mx = INT_MIN;
long long mn = INT_MAX;
long long mod = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long cnt = 0;
  for (long long i = 1; i < n - 1; i++) {
    if (a[i] == 0) {
      if (a[i - 1] == 1 && a[i + 1] == 1) {
        cnt++;
        a[i - 1] = 0;
        a[i + 1] = 0;
      }
    }
  }
  cout << cnt;
  return 0;
}
