#include <bits/stdc++.h>
using namespace std;
long long int powm(long long int base, long long int exp) {
  long long int ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base) % 1000000007;
    exp >>= 1, base = (base * base) % 1000000007;
  }
  return ans;
}
int main() {
  long long int n;
  cin >> n;
  long long int a[n + 1], cnt = 0;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n - 1; i++) {
    if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1) {
      cnt += 1;
      a[i + 1] = 0;
    }
  }
  cout << cnt << '\n';
}
