#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0, flag = 0;
  int arr[100];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] != arr[i + 1]) {
      flag = 1;
    }
  }
  if (flag == 0) {
    cout << ans << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (arr[i] == 0 && arr[i - 1] == 1 && arr[i + 1] == 1) {
      arr[i + 1] = 0;
      ans++;
    }
  }
  cout << ans;
  return 0;
}
