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