#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long d = 0;
  set<long long> ds;
  for (long long i = 1; i < n - 1; i++) {
    if (arr[i] == 0 && arr[i - 1] == arr[i + 1] && arr[i - 1] == 1) {
      d++;
      ds.insert(i);
    }
  }
  long long r = 0;
  while (ds.empty() == 0) {
    auto it = ds.begin();
    auto itr = it;
    itr++;
    if (itr != ds.end() && *itr - *it == 2) {
      ds.erase(itr);
    }
    ds.erase(it);
    r++;
  }
  cout << r << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T;
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
