#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> v(n + 5);
  for (long long i = 1; i < n + 1; ++i) {
    cin >> v[i];
  }
  long long ans = 0;
  for (long long i = 2; i < n; ++i) {
    if (v[i] == 0 and v[i - 1] == 1 and v[i + 1] == 1) {
      ans++;
      v[i + 1] = 0;
    }
  }
  cout << ans << "\n";
  return 0;
}
