#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  string s;
  long long n, a[110], ans = 0;
  cin >> n >> a[1] >> a[2];
  for (int i = 3; i <= n; i++) {
    cin >> a[i];
    if (a[i - 2] == 1 && a[i - 1] == 0 && a[i] == 1) {
      a[i] = 0;
      ans++;
    }
  }
  cout << ans;
}
