#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
const int N = 1e3 + 10;
const int mod = 1e9 + 7;
const long long maxll = 9223372036854775807;
const long long minll = -9223372036854775808;
long long a[maxn];
void solve() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 1; i < n - 1; i++) {
    if (a[i] == 0 and a[i - 1] == 1 and a[i + 1] == 1) {
      ans++;
      a[i + 1] = 0;
    }
  }
  cout << ans;
  return;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  solve();
  return 0;
}
