#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; string s; cin >> n >> s; constexpr array S = {0b011, 0b101, 0b110, 0b111}; array dp{}, ndp; for(int i = 0; i < n; i++){ ndp.fill(1 << 30); int c = s[i] - '0'; for(auto U : S){ int NU = U / 2 + 4 * c; ndp[NU] = min(ndp[NU], dp[U]); ndp[NU ^ 4] = min(ndp[NU ^ 4], dp[U] + 1); } dp = ndp; } int ans = 1 << 30; for(auto U : S) ans = min(ans, dp[U]); cout << ans << '\n'; }