#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int num[100010];
int main() {
  int n;
  int ara[110];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ara[i];
  }
  int ans = 0;
  for (int i = 1; i < n - 1; i++) {
    if (ara[i - 1] == 1 && ara[i] == 0 && ara[i + 1] == 1) {
      ara[i + 1] = 0;
      ans++;
    }
  }
  cout << ans;
}
