#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (i > 0 && i < n - 1 && v[i - 1] == 1 && v[i] == 0 && v[i + 1] == 1)
      ans++, v[i + 1] = 0;
  cout << ans << endl;
  return 0;
}
