#include <bits/stdc++.h>
using namespace std;
int n, ans = 0, k = INT_MAX;
const int MAXN = 1000;
char s[MAXN];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n - 2; i++) {
    if (s[i] == '1' && s[i + 1] == '0' && s[i + 2] == '1' && k - i != -2) {
      ans++;
      k = i;
    }
  }
  cout << ans << endl;
  return 0;
}
