#include <bits/stdc++.h>
using namespace std;
int a[120], f[120][2];
int main(void) {
  int n;
  int i;
  vector<int> v;
  scanf("%d", &n);
  v.clear();
  v.push_back(0);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i]) v.push_back(i);
  }
  for (i = 1; i < (signed)v.size(); i++) {
    if (v.at(i - 1) + 2 == v.at(i))
      f[i][0] = f[i - 1][1];
    else
      f[i][0] = min(f[i - 1][0], f[i - 1][1]);
    f[i][1] = min(f[i - 1][0], f[i - 1][1]) + 1;
  }
  printf("%d\n", min(f[v.size() - 1][0], f[v.size() - 1][1]));
  return 0;
}
