#include <bits/stdc++.h>
using namespace std;
int n, m = 1, k = 0, a[105], s[105], c = 1, p = 0;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  a[0] = a[1];
  a[n + 1] = a[n];
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1) s[m++] = i;
  }
  m--;
  for (int i = 1; i <= m; i++) {
    while (s[i] + 2 == s[i + 1]) {
      c++;
      i++;
      p = 1;
      if (i >= m) break;
    }
    if (p == 1) {
      k += (c + 1) / 2;
      c = 1;
      p = 0;
    } else {
      k++;
    }
  }
  cout << k << endl;
  return 0;
}
