#include #include using namespace std; int main() { int N; string S; cin >> N >> S; int operations = 0; int count_0 = 0; for (int i = 0; i < N; ++i) { if (S[i] == '0') { count_0++; } else { if (count_0 > 0) { operations += count_0 - 1; } count_0 = 0; } } if (count_0 > 0) { operations += count_0 - 1; } cout << operations << endl; }