/* -*- coding: utf-8 -*- * * 3114.cc: No.3114 0竊・ - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ /* global variables */ char s[MAX_N + 4]; /* subroutines */ /* main */ int main() { int n; scanf("%d%s", &n, s); int cnt = 0, on = 2; for (int i = 0; i < n; i++) { if (s[i] == '0') { if (on <= 1) cnt++, s[i] = '1', on++; else on = 0; } else on++; } printf("%d\n", cnt); //puts(s); return 0; }