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