#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[150], sum, sum1, sum2, i;
  while (cin >> n) {
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    sum1 = 0, sum2 = 0;
    for (i = 1; i < n; i++) {
      if (a[i] == 0) sum1++;
    }
    for (i = 1; i < n - 1; i++) {
      if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1) a[i + 1] = 0;
    }
    for (i = 1; i < n; i++) {
      if (a[i] == 0) sum2++;
    }
    sum = sum2 - sum1;
    cout << sum << endl;
  }
  return 0;
}
