#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (auto &x : v) cin >> x;
  long long int ans = 0;
  for (long long int 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 << "\n";
}
