#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  long long cnt = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    if (a[i] == 0) {
      if (a[i - 1] == 1 && a[i + 1] == 1) {
        a[i + 1] = 0;
        cnt++;
      }
    }
  }
  cout << cnt;
}
