#include <bits/stdc++.h>
using namespace std;
long long a, b, man, mix, l, r, o, d[20000], ans, ans1;
vector<long long> v[100000], v1;
set<long long> st;
map<long long, long long> mp, mp1;
string s, s1, s2;
pair<int, int> p[100000];
char c[1000000];
deque<long long> dq[100000];
bool bo, ol;
int main() {
  cin >> a;
  for (int i = 0; i < a; i++) {
    cin >> c[i];
  }
  for (int i = 1; i < a - 1; i++) {
    if (c[i - 1] == '1' && c[i] == '0' && c[i + 1] == '1') {
      c[i + 1] = 0;
      l++;
    }
  }
  cout << l;
}
