#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const double EPS = 1e-9;
const int mod = 1e9 + 7;
inline void File() {}
void myMain() {
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int &it : arr) cin >> it;
  int cnt = 0;
  for (int i = 2; i < n; i++) {
    if (arr[i - 2] == 1 and arr[i - 1] == 0 and arr[i] == 1) cnt++, arr[i] = 0;
  }
  cout << cnt << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  File();
  int t = 1;
  while (t--) {
    myMain();
  }
}
