#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = 2e9;
const ld EPS = 1e-9;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long ans = 0;
  for (long long i = (0); i < (n); ++i) cin >> a[i];
  for (long long i = (1); i < (n - 1); ++i) {
    if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1) {
      ++ans;
      a[i + 1] = 0;
    }
  }
  cout << ans;
}
