#include using namespace std; using ll = long long; const int iinf = 1e9; const ll inf = 1e18; template ostream& operator<<(ostream &o, vector v) { for (int i = 0; i < v.size(); i++) o << v[i] << (i+1sync_with_stdio(false); int N; string S; cin >> N >> S; S = "11" + S; vector dp(4, inf), ndp(4, inf); auto valid = [&](int b1, int b2){ if(b1==0 && b2==0) return false; return true; }; dp[3] = 0; for(int i = 2; i < N+2; i++){ fill(ndp.begin(), ndp.end(), inf); for(int st = 1; st < 4; st++){ if(dp[st] == inf) continue; int p1 = (st>>1)&1, p2 = st&1; if(S[i]=='0'){ int x = 0; if(!(p1==0 && p2==1 && x==0)){ if(valid(p2,x)){ int nst = (p2<<1) | x; ndp[nst] = min(ndp[nst], dp[st] + 0); } } } { int x = 1; if(valid(p2,x)){ int nst = (p2<<1) | x; ndp[nst] = min(ndp[nst], dp[st] + (S[i]=='0'?1:0)); } } } swap(dp, ndp); } ll ans = inf; for(int st = 1; st < 4; st++){ ans = min(ans, dp[st]); } cout << ans << "\n"; return 0; }