#include <bits/stdc++.h>
int main() {
  int n, a[101], ans;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 2; i < n; i++)
    if (a[i] == 0)
      if (a[i - 1] == a[i + 1] && a[i + 1] == 1) a[i] = 2;
  ans = 0;
  for (int i = 2; i < n; i++)
    if (a[i] == 2) {
      if (a[i + 2] == 2) {
        ans++;
        a[i + 2] = 3;
      } else
        ans++;
      a[i] = 3;
    }
  printf("%d", ans);
  return 0;
}
