#include <bits/stdc++.h>
using namespace std;
long long a[500009], b[500009];
bool f(long long n, long long i) { return n & (1 << i); }
map<long long, long long> mp;
map<long long, long long> mp1;
map<long long, long long> mp2;
int main() {
  cin.sync_with_stdio(false);
  long long i, j, k, l, c, v, n, m, r, t;
  long long x1, x2, y1, y2, x3, x4, x5, x6;
  double dd[300];
  string s[2000], s1, s2, s3;
  while (cin >> n) {
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    c = 0;
    for (i = 1; i < n - 1; i++) {
      if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1) {
        c++;
        a[i + 1] = 0;
      }
    }
    cout << c;
  }
}
