#include <bits/stdc++.h>
using namespace std;
long long n, cnt = 0, ans = 0;
int main() {
  cin >> n;
  long long a[n], tmp[n];
  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) {
      tmp[cnt++] = i;
    }
  tmp[cnt] = 101;
  for (long long i = (0); i < (cnt); i++) {
    if (tmp[i + 1] - tmp[i] == 2) {
      ans++;
      i++;
    } else
      ans++;
  }
  if (cnt == 1) ans = 1;
  cout << ans << endl;
  return 0;
}
